Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
How to add meta data to a page? #358
To improve the readability of twitter links it is possible, to add "twitter card tags" to a page. This is nothing special, only twitter named meta tags:
I asked myself, if I can simply add these to the header to achieve meta entries. (The answer is no.)
Before I deal with it more intensively and possibly waste pointless time, I would like to ask a few questions:
I am not shure if a plugin would be a good solution for that. The samples above may include another challenge, because they us a colon (:) to separate namespaces ("twitter:*") which is used in yellow header to mark the end of the header tag.
Maybe I simply missed an existing solution – I this case an url is welcome ;)
As for the twitter plugin, additional metadata easily can be added using the
And just in case you would like to have this without installing a plugin, you can also modify your
This works with any custom metadata you would like to have in your page.
thank you very much for your profound input!
I tried the "header upgrade" that works fine after adding a few "echos". To have an additional site info I switched to
<meta name="twitter:card" content="summary_large_image"> <meta name="twitter:title" content="<?php echo $yellow->page->getHtml("titleHeader") ?>" /> <meta name="twitter:description" content="<?php echo $yellow->page->getHtml("description") ?>" /> <?php if ($yellow->page->getHtml("image")): ?> <meta name="twitter:image" content="<?php echo $yellow->page->getHtml("image") ?>" /> <?php endif ?>
As mostly, solutions in YELLOW are much easier as expected. Modifying the header-snippet is (in my opinion) better than using a plugin for this effort.
Edit: I added the necessary line "twitter:card"…
Edit II: I tested a few things but it seems, as if there is something more neccessary to get it expanded as desired.
I think, there are two different targets. The twitter plugin displays twitter in a YELLOW page, the "twitter cards" format the display at twitter in this case the appearance of a link to a YELLOW page.
Currently, I have to stop my investigations. The expected „card“ does not appear on twiter in spite of these meta entries. Possibly there is something additionally required. Because of lack of time I can not say, when I am able to check this.
I think you at least need to define a card type, e.g.:
I'm making great success with my social media plugin, however the open graph tags are a little tricky. To validate the page you have to extend the opening
The "missing link" is
<meta name="twitter:site" content="@Twitter-Account-Name" />
Without an account there is no display. This meta is mandatory.
I took a short look on your socialtags plugin: Chapeau!
I will remove my own modifications and use your plugin instead. It solves the requirements perfectly.
Instead of offering a completely header.php it might be better to describe the required modification in the readme file. The
The "How to configure" possibly should advice, that the SocialTagTwitterUser has to be given, otherwise, the plugin will not work as expected. Additionally, instead of offering a header file, the "How to install" should better explain, how it works:
… <?php echo $yellow->page->getExtra("header") ?> </head> …
With this, you cover the possible situation, that more than one header snippet are used in different site areas.
Same with required open graph additionals.
Personally, I prefer configuration of plugins in the plugin itself, to keep the things as good as possible together instead spreading them into places. The only exception is the requirement of same information in more than one plugin. As far as I know and have seen this happens only for environmental settings (eg image path, translations … ) , mostly never for plugin specific things.