-
-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
Structured Data 3.0 #6534
Comments
I've quoted bits I have questions on or that were questions below...
Cool, so we need some new db fields (no biggy, I've added them to #6301) - I think it makes 100% sense to add these as they're so ubiquitous. From a UI perspective, I think the user would expect to copy & paste a whole URL for facebook, but only put their
👍
Yep, for sure 👍
Yep! It's here: #4424. It was made very clear that we should not auto generate a meta description, as google does this. However, I think this same rule has been incorrectly applied to twitter and og descriptions. I guess the twitter & og ones should come from excerpt? |
refs TryGhost#6534 - this is an initial fix for having no description at all unless a meta description is provided - we may need to tweak the lengths / provide different lengths for different values in future
For v1 - let's just make them both URLs? It's so much easier to validate and the UX is consistent between the two, at least. |
Sounds exciting! |
This looks cool! :) |
refs TryGhost#6534 - fixes a bug where published_at was incorrectly falling back to the created_at date - updated meta index to get author name - add written by & filed under labels + data if the values are present (only on posts/pages) - updated tests
Just noticed that for some reason we don't output structured data on page templates, which we probably should. Added to task list |
@JohnONolan what about the paginated versions of the home, tag, author channels? Atm we don't do it there either. |
I think that's still ok as-is 👍🏻 |
refs TryGhost#6534 - adds structured data on static pages - selects post context object for static pages - updates tests
closes TryGhost#6534 - new input fields in general settings incl. validation - facebook and twitter as new models in settings.js - adds values for facebook and twitter to default-settings.js - adds blog helpers for facebook and twittter - rather than saving the whole URL, the Twitter username incl. '@' will be extracted from URL and saved in the settings. The User will still input the full URL. After saving the blog setting, the stored Twitter username will be parsed again as the full URL and available in the input field. A custom transform is used for this. - adding meta fields to be rendered in {{ghost_head}}: - '<meta property="article:publisher" content="https://www.facebook.com/page" />' and - '<meta name="twitter:site" content="@user"/>' - adds facebook and twitter to unit test for structured data - adds unit test for general settings - adds acceptance test for new input fields in general settings - adds a custom transform for twitter model to save only the username to the server - adds unit test for transform
closes TryGhost#6534 - new input fields in general settings incl. validation - facebook and twitter as new models in settings.js - adds values for facebook and twitter to default-settings.js - adds blog helpers for facebook and twittter - rather than saving the whole URL, the Twitter username incl. '@' will be extracted from URL and saved in the settings. The User will still input the full URL. After saving the blog setting, the stored Twitter username will be parsed again as the full URL and available in the input field. A custom transform is used for this. - adding meta fields to be rendered in {{ghost_head}}: - '<meta property="article:publisher" content="https://www.facebook.com/page" />' and - '<meta name="twitter:site" content="@user"/>' - adds facebook and twitter to unit test for structured data - adds unit test for general settings - adds acceptance test for new input fields in general settings - adds a custom transform for twitter model to save only the username to the server - adds unit test for transform
refs TryGhost#6534 - don't output publisher for the 'People' type on the author page - change publisher to a full 'Organisation' for the 'Article' type on posts Note: Google's structured data validator also wants image & publisher.logo inside of Article to be full 'ImageObject's. Currently, it output's an error for them: 'The attribute itemtype has an invalid value.' However, the spec on Schema.org says a url is valid: https://schema.org/Article, which is slightly different to Google's spec here: https://developers.google.com/structured-data/rich-snippets/articles#article_markup_properties Ideally, we would output a full 'ImageObject', however we don't currently have the width & height info required. Therefore, I think what we have is valid strictly speaking, but we should aim to fix this when we have better image tools.
Adding a note here to summarise some conversations that happened in #dev and some changes that are now being made. For both the blog & user settings, we will only be storing the "username" part of the facebook & twitter urls. These are the unique information, whereas the remainder of the URL is the same for everyone and very simple to provide helpers for if needs be. Therefore, when accessing The structured data will be updated to generate the URLs from the usernames, using a new set of utilities. To make it nice and easy for themes to output the full url, we'll be adding two new helpers:
If you're not inside an "author" or "user" object, then the helper will default to the blog's twitter URL. If the default behaviour is not what you want, then you can tell it exactly what to output the url for, E.g. The The facebook version of the helper will be exactly the same, except it will output correct facebook urls, which include the |
refs TryGhost#6534 - this PR assumes that we are now saving usernames only in the database for twitter & facebook - adds a new social links utility which can generate twitter & facebook urls from the username - adds a {{twitter_url}} and {{facebook_url}} helper which uses these - adds a full suite of tests for the helpers & utils
refs TryGhost#6534 - twitter & facebook fields are changing to store usernames only - use the new social url util to generate urls where necessary - update tests
refs TryGhost#6534 - this PR assumes that we are now saving usernames only in the database for twitter & facebook - adds a new social links utility which can generate twitter & facebook urls from the username - adds a {{twitter_url}} and {{facebook_url}} helper which uses these - adds a full suite of tests for the helpers & utils
refs TryGhost#6534 - twitter & facebook fields are changing to store usernames only - use the new social url util to generate urls where necessary - update tests
refs TryGhost#6301, TryGhost#6534 - adds facebook and twitter columns, which should contain urls
closes TryGhost#6534 - new input fields in general settings incl. validation - facebook and twitter as new models in settings.js - adds values for facebook and twitter to default-settings.js - adds blog helpers for facebook and twittter - rather than saving the whole URL, the Twitter username incl. '@' will be extracted from URL and saved in the settings. The User will still input the full URL. After saving the blog setting, the stored Twitter username will be parsed again as the full URL and available in the input field. A custom transform is used for this. - adding meta fields to be rendered in {{ghost_head}}: - '<meta property="article:publisher" content="https://www.facebook.com/page" />' and - '<meta name="twitter:site" content="@user"/>' - adds facebook and twitter to unit test for structured data - adds unit test for general settings - adds acceptance test for new input fields in general settings - adds a custom transform for twitter model to save only the username to the server - adds unit test for transform
refs TryGhost#6534 - don't output publisher for the 'People' type on the author page - change publisher to a full 'Organisation' for the 'Article' type on posts Note: Google's structured data validator also wants image & publisher.logo inside of Article to be full 'ImageObject's. Currently, it output's an error for them: 'The attribute itemtype has an invalid value.' However, the spec on Schema.org says a url is valid: https://schema.org/Article, which is slightly different to Google's spec here: https://developers.google.com/structured-data/rich-snippets/articles#article_markup_properties Ideally, we would output a full 'ImageObject', however we don't currently have the width & height info required. Therefore, I think what we have is valid strictly speaking, but we should aim to fix this when we have better image tools.
refs TryGhost#6534 - this PR assumes that we are now saving usernames only in the database for twitter & facebook - adds a new social links utility which can generate twitter & facebook urls from the username - adds a {{twitter_url}} and {{facebook_url}} helper which uses these - adds a full suite of tests for the helpers & utils
refs TryGhost#6534 - twitter & facebook fields are changing to store usernames only - use the new social url util to generate urls where necessary - update tests
Those of you who know me, know I'm all about that
bassstructured data. We've got pretty awesome support for it already, via iteration 1.0 #3900 and 2.0 #4677 - and now I'd like to propose a few more enhancements, which I think should be relatively straightforward. Might be something for @AileenCGN?I noticed this on Facebook this morning, and thought it was pretty cool. Also this by Slack a while back, which is equally cool.
So a bunch of things that I think we could potentially do to be more mobile, social, global and local.
Or, as I call it: Mosoglocal 💃
Publisher and Site
Add a general setting to blogs for "Facebook URL" and "Twitter URL" - which we should validate, and then we could output:
Applies to ALL page templates
NB: According to docs
twitter:site
is actually required for Twitter Cards to work at all.This would also justify the creation of new theme helpers, probably
{{@blog.facebook}}
and{{@blog.twitter}}
?Author and Creator
Add a user setting for "Facebook URL" and "Twitter URL" - which we should validate, and then we could output the bits from my screenshot before:
"Why add Facebook and Twitter profile properties? Isn't that clutter?" - kind of, but I think it's safe to say they would be widely used, and we already have support for Facebook Open Graph and Twitter Cards, so it makes sense. Longer term I'd be interested if we could make admin defined user profile properties like Slack recently did?
Applies to post, page, and author profile templates
Note: For rich data, deliberate use of
www
in facebook URLs output and nowww
in twitter URLs output. That's how both of those sites work - so minimal redirects by just using their preferred structure right off the bat.JSON+LD docs ref here.
This would also justify the creation of new theme helpers, probably
{{author.facebook}}
and{{author.twitter}}
?Slack Unfurls
This would add some rich data to Slack embeds. Source. Not sure if this is valid, because it's essentially a duplication of other properties (author and date) -- but seeing as every service except Slack is going to ignore it... do we care?
Applies to post and page templates
Locale
It would be great to add a blog language general setting and output this both via Open Graph and via a
{{locale}}
helper available for themes, and to affect the format of{{date}}
- this one probably warrants its own issue.Applies to ALL page templates
Bug in Description
Just noticed we seem to be outputting empty descriptions. We should either populate description with ~50 chars of
{{excerpt}}
or not display the description tags at all. I thought this was specced in an older issue, but can't seem to find it now. I wonder if this is what's causing the current bug of Slack refusing to unfurl any Ghost blog post? Eg.Just confirmed this bug is actively preventing twitter cards from working.
Tasks:
The text was updated successfully, but these errors were encountered: