asciidoctor
asciidoctor copied to clipboard
Add Open Graph and Twitter card support to html5 backend
Not sure if there was further thinking on how to implement issues #199 and #503, but it is something I need in a set of pages I'm working on. So I added this to the html5 backend. I can add documentation and tests too, but before investing time there I'd like to know if this is roughly a reasonable approach.
This might impact Jekyll users of the jekyll-seo-tag plugin (I'm actually one of them), if they declare these attributes in the document header, but usually the SEO config there is part of the _config.yml file. In that case they might get double the Open Graph and Twitter tags, but that might not actually be a problem.
I've put these document header attributes to work for me here, here, and here. "View source" to see the output.
The tags work correctly with the Twitter Card Validator and Facebook Sharing Debugger.
@nuket can you please also add ld+json ? (Check my #3883) it should be mostly reuse what you've for twitter and opg.
I'm concerned how much extra metadata this is going to add to the HTML output by default (which affects tens of thousands of users). We need to tame this by putting it behind a feature flag like seo or seo-tags or something. It also needs to be moved to a method. Though I wonder if it would be even better to move it all to an extension and make some sort of extension point. Feel free to share some ideas so we can get a clearer picture of what action to take here.
...or maybe we could reuse the existing docinfo extension point and make this a shared library.
Having it out of the box, will increase the 'seo' for HTML generated docs (html is for the web, isn't it?), but having to enable an extra feature is not like a big deal if that will accomodate the users already doing this, and still empower other uses that will get extra benefit from search engines 'understanding' better what the document is about.
If the problem is the extra 'code', an HTML compressor can be used to minify it (and probably should be) but for the whole document, not just headers.
I cannot commend about the way to do this as I'm not that familiar with the asciidoctor code
This PR is almost two years old. Is there still interest in adding support for twitter, etc, to the html5 backend?
I think this is best done using an extension. I've expressed this concern several times already, so my position is very clear. This is too specific to current social media services for it to be general purpose enough to include in the core converter. There are a lot of attributes being introduced here without any sort of standarization process. I'd rather those attribute names be first defined in the language specification if they are going to be a core part of AsciiDoc.
Thanks for the quick response.
I'm pretty new to the asciidoctor ecosystem, experimenting with it in earnest right now. When I search for "asiidoc Twitter" I find this PR and the linked issue. From that very basic perspective, your position is only clear insofar as both the issue and PR are long neglected. :)
If I may, I'd suggest closing both?
I don't have time to do that right now. Given this is a open source project, I'm under no obligation to provide any additional information. When I have the time, I will do so. If someone wants to take this initiative further, and post some information about how to add SEO metadata to the HTML output, they are also free to do so.
I don't have time to do that right now. Given this is a open source project, I'm under no obligation to provide any additional information. When I have the time, I will do so. If someone wants to take this initiative further, and post some information about how to add SEO metadata to the HTML output, they are also free to do so.
These tags are not necessarily "SEO" related, they are related to marketing and presentation of pages.
When page has OpenGraph or Schema.org or Twitter tags, such page knows which image to present, and by simple including of a link, system fetch image, title, description and present nicer those pages. It is crucial today for many systems, social networks, chat systems and similar.
In other words, visitors learn about the page before visiting the page and it helps to promotion.
I think this is best done using an extension. I've expressed this concern several times already, so my position is very clear. This is too specific to current social media services for it to be general purpose enough to include in the core converter. There are a lot of attributes being introduced here without any sort of standarization process. I'd rather those attribute names be first defined in the language specification if they are going to be a core part of AsciiDoc.
Actually not, it is not so specific to current social media. Twitter tags are used in many other pages and networks, it is not for Twitter only. Schema.org and Opengraph are now standards. It is used on too many information channels of various types.
I would actually remove Twitter because it's name is too specific, and keep Schema.org and Opengraph.
I'm concerned how much extra metadata this is going to add to the HTML output by default (which affects tens of thousands of users). We need to tame this by putting it behind a feature flag like
seoorseo-tagsor something. It also needs to be moved to a method. Though I wonder if it would be even better to move it all to an extension and make some sort of extension point. Feel free to share some ideas so we can get a clearer picture of what action to take here.
It is not "SEO" related so much. It is not good using that term seo.
Rather something like:
:schema-org-name: TITLE :schema-org-description: DESCRIPTION :schema-org-image: IMAGE
:og-title: TITLE :og-type: Article :og-url: LINK :og-image: IMAGE :og-site-name: Site Name :og-description: DESCRIPTION
By using those tags users could decide which one to include.
Or give us just general method to include <meta tags, then I can solve it.