We build. You grow.

Get best community software here

Start a social network, a fan-site, an education project with oxwall - free opensource community software

Oxwall - SEO - Remove wrong facebook meta tags | Forum

OW-Ghost
OW-Ghost Jul 5

Hello oxwallers im back

How can i remove meta tags in Oxwall software or any software. The Oxwall core loads on auto wrong Facebook meta tags.

Wrong value (generated by Oxwall):

<meta name="og:type" content="website" />

Correct value:

<meta property="og:type" content="website" />

Thanks in Advance

Ow_ghost


https://stackoverflow.com/questions/62622360/oxwall-remove-meta-tags

The Forum post is edited by OW-Ghost Jul 5
Patricia Zorrilla Leader

If it is as simple as replacing one expression with another, a very simple way can be to make a copy of all OxWall files and folders on your personal computer (excludes ow_userfiles which is huge and does not contain code files),

You make a backup of all this, and with the text editor -free -atom.io you can open the whole tree and do a global "search and replace" of "<meta name" with "<meta property".

To download and later upload all these folders you can do it by FTP with the winscp.net program or another similar one

Once the files are uploaded, you have to activate the DEBUG mode, view the web and deactivate the DEBUG mode, here it indicates the steps to follow:

https://wiki.oxwall.com/plugin-tuts:enable-debug

OW-Ghost
OW-Ghost Jul 5
I no doubt it will working and thank you for the help Patricia.


But i looking for remove the script that add the wrong meta.


I remember long time ago someone told me about where all SEO is handle in oxwall. I think it is a php file with name SEO but i forget where it is placed?


Could someone help me find it?


I will try read and understand the code how it works and take backup before do any changes inside the code.


Thanks


Ow-Ghost

The Forum post is edited by OW-Ghost Jul 5
OW-Ghost
OW-Ghost Jul 5
Another option then try find the place in the core would bee search for words "og:type" in all files and folders. 


But how to do that? I not use FTP on my website. 


Patricia you are skilled and have many programs installed


Patrica could you "search" on your test website for "og:type" and see if you find the place it add wrong meta


Thank you


Ow-Ghost

Patricia Zorrilla Leader

It is only on 6 sites!


OW-Ghost
OW-Ghost Jul 5
I think you was find it :)


ow_system_plugins/base/classes/event_handler.php



Thank you :)


I hope i can out comment some lines there with out hurt the core? :)


Ow_ghost

The Forum post is edited by OW-Ghost Jul 5
OW-Ghost
OW-Ghost Jul 7

How to write this code correct and proper?


The value "addMetaInfo" is create wrong attribute for facebook.



        //add og

        $imageUrl = BOL_SeoService::getInstance()->getSocialLogoUrl();


        if( !empty($params["image"]) )

        {

            $imageUrl = trim($params["image"]);

        }


        $document->addMetaInfo("og:type", "website");

        $document->addMetaInfo("og:site_name", OW::getConfig()->getValue('base', 'site_name'));


        if( $title )

        {

            $document->addMetaInfo("og:title", $title);

        }


        if( $desc )

        {

            $document->addMetaInfo("og:description", $desc);

        }


        if( $imageUrl )

        {

            $document->addMetaInfo("og:image", $imageUrl);

        }


        if( $title )

        {

            $document->addMetaInfo("twitter:title", $title);

        }


        if( $desc )

        {

            $document->addMetaInfo("twitter:description", $desc);

        }


        if( $imageUrl )

        {

            $document->addMetaInfo("twitter:image", $imageUrl);

        }

    }


    protected function processMetaText( $text, $escape = true, $maxLength = null )

    {

        if( $escape )

        {

            $text = htmlspecialchars(trim($text));

        }

        else

        {

            $text = str_replace('"', "", strip_tags($text));

        }


        if( $maxLength !== null && mb_strlen($text) > $maxLength )

        {

            $text = UTIL_String::truncate($text, $maxLength - 3, '...');

        }


        return $text;

    }

}

The Forum post is edited by OW-Ghost Jul 7
OW-Ghost
OW-Ghost Jul 7
What happen if i replace:


 $document->addMetaInfo("og:type", "website");


with:


 $document->addMetaInfo('og:type','website','property');




i need some help i not good at php and my feelins says that is not correct code to replace. i just guessing wild and maybe i can learn something if i get the correct code

The Forum post is edited by OW-Ghost Jul 7
Marcus
Marcus Jul 7
$document->addMetaInfo('og:type','property');

try this
OW-Ghost
OW-Ghost Jul 7
thanks marcus


but it did not work, i was get


<meta name="og:type" content="property" />


with your code


it is the "<meta name=" that need bee switch to "<meta property="


hmmm interesting :)


I know there is a solution but i not that skilled about php so i can solve this

The Forum post is edited by OW-Ghost Jul 7
Marcus
Marcus Jul 8
u can get rid of all that seo stuff and use document addcustominfo function to add whatever u want to head portion of the page. latet ill post some code. stay tuned. just got up coffee hasnt kicked in yet. crazy headache from too much visual stimulation lol
The Forum post is edited by Marcus Jul 8
OW-Ghost
OW-Ghost Jul 8
ahaa there is another document addcustominfo ? :) yes i think addmetainfo is only put wrong name all he time so it need bee replaced with something else 


okey i wait for your coffe kicked in :)


(i agree the best would bee remove all that oxwall SEO code because it is out dated and make you website not visible when put out dated metas on auto in top of pages.)

The Forum post is edited by OW-Ghost Jul 8
OW-Ghost
OW-Ghost Jul 8
Another solution would bee:


1. Remove all that code at end of ow_system_plugins/base/classes/event_handler.php

2. Add new metas in admin panel /admin/settings/page "custom head section".


Not a proper solution, but i think a quick fix.


A small step in to future with better SEO.


This should bee forward to oxwall TEAM to fix in next version.

The Forum post is edited by OW-Ghost Jul 8
Marcus
Marcus Jul 8

Its a dirty fix but this is just to give you an idea that it can be done. It can be easily done with a plugin by calling:

getMeta();

setMeta();


No here is the fix itself.


find: $eventManager->bind("base.provide_page_meta_info", array($this, 'onProvideMetaInfoForPage'));


replace with:    

  

// $eventManager->bind("base.provide_page_meta_info", array($this, 'onProvideMetaInfoForPage'));
       
 $eventManager->bind("base.provide_page_meta_info", array($this, 'mySeoFix'));


Now find: public function init()


add this code right about it:


public function mySeoFix()
    {
        $codes = "<meta property=\"og:type\" content=\"website\" />";
    OW::getDocument()->addCustomHeadInfo($codes);
    }

The Forum post is edited by Marcus Jul 8
OW-Ghost
OW-Ghost Jul 8
ahhh little bit same obazi did.


He created a new function that was replace old one.


still i think you need delete the old SEO code in ow_system_plugins/base/classes/event_handler.php


hmmm


interesting indeed, many solutions provided :)


I think i go for my quick fix remove code and add new metas in header section ,but all ideas are welcome 


Thanks Marcus!

The Forum post is edited by OW-Ghost Jul 8
OW-Ghost
OW-Ghost Jul 8
strange


https://developers.facebook.com/tools/debug/


refuse read metas if add them in head section? 


why? what is wrong?

OW-Ghost
OW-Ghost Jul 8
i think, forget about add custom meta in head section in a oxwall website


look like it need bee insirted before head section


so back to zero again 

OW-Ghost
OW-Ghost Jul 8
Finaly i find the best solution.


You have to do like this:


1. Go to ow_system_plugins/base/classes/event_handler.php and end of the file remove or out comment all the lines where it add wrong facebook meta:


Example:


// $document->addMetaInfo("og:type", "website");


2. Go to /ow_system_plugins/base/init.php and at top of file add code like this:


function modify_custom_meta_property(){    

OW::getDocument()->addMetaInfo('og:type', 'website', 'property');    

OW::getDocument()->addMetaInfo('og:title', 'Your awsome title here', 'property');

OW::getDocument()->addMetaInfo('og:url', 'your website url here', 'property');

OW::getDocument()->addMetaInfo('og:description', 'your website description here', 'property');

OW::getDocument()->addMetaInfo('og:image', 'your image url here', 'property');

OW::getDocument()->addMetaInfo('fb:app_id', 'app id here', 'property');

}

OW::getEventManager()->bind(OW_EventManager::ON_BEFORE_DOCUMENT_RENDER, 'modify_custom_meta_property');


Clear your website cache and look the source code of your page, now correct metas should bee added and the wrong metas gone.


Thanks everyone for solve this SEO issue with some tricks.


Hopefully they will fix this in a new oxwall version so you not need add this everytime there is a update. Because it will bee overwrite when you upgrade oxwall to a new version.


Another option you create a plugin that do all this


Regards


Ow_ghost

The Forum post is edited by OW-Ghost Jul 8
dave Team
dave Jul 24
Topic was moved from General Questions.