Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Request] Meta Tag Variable or Open Graph implantation #62

Open
ErikThiart opened this issue Mar 5, 2018 · 4 comments
Open

[Request] Meta Tag Variable or Open Graph implantation #62

ErikThiart opened this issue Mar 5, 2018 · 4 comments

Comments

@ErikThiart
Copy link

ErikThiart commented Mar 5, 2018

Hello, Ii added Open Graph tags to my forum in the headerinclude page, what I am looking for is a way to dynamically populate that open graph description tag like you do with the meta tag.

My question, do you have a variable that I can use/hook almost like:

<meta property="og:description" content="{{google-seo-desc}}" />

Alternatively, can you just build in Open Graph support?

@frostschutz
Copy link
Owner

There is no variable, unfortunately. You'd have to change code for that (meta.php).

I currently have no plans to support open graph, twitter cards, etc., they have a lot more options, it might be better to handle those in a separate addon.

@ErikThiart
Copy link
Author

ErikThiart commented Mar 6, 2018

Thank you for the reply, I appreciate that.

Dammit, was hoping I can somehow hook into this:

function google_seo_meta_description($description)
{
    global $settings, $plugins, $google_seo_meta;
    if($settings['google_seo_meta_length'] > 0)
    {
        $description = strip_tags($description);
        $description = str_replace("&nbsp;", " ", $description);
        $description = preg_replace("/\\[[^\\]]+\\]/u", "", $description);
        $description = preg_replace("/\\s+/u", " ", $description);
        $description = trim($description);
        $description = my_substr($description, 0, $settings['google_seo_meta_length'], true);
        $description = trim($description);
        if($description)
        {
            $plugins->add_hook('pre_output_page', 'google_seo_meta_output');
            $google_seo_meta = "<meta name=\"description\" content=\"{$description}\" />\n{$google_seo_meta}";
        }
    }
}

What I currently did is add all the social meta tags on the site in the headerinclude I am able to dynamically populate the title for each meta tag, it's just the description that is missing a hook.

@frostschutz
Copy link
Owner

You can change that code:

$google_seo_meta = "<meta name=\"description\" content=\"{$description}\" />\n

to add another meta description tag using the same $description.

@ErikThiart
Copy link
Author

Smart!
Did not think of that... Might build all the Open Graph Tags into that variable...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants