statamic / seo-pro

An all-in-one site reporting, metadata wrangling, Open Graph managing, Twitter card making, sitemap generating, turn-key addon for Statamic.
https://statamic.com/addons/statamic/seo-pro
52 stars 34 forks source link

Add structured data support #28

Open bgarrant opened 6 years ago

bgarrant commented 6 years ago

Any plans for Structured Data Support?

jackmcdade commented 6 years ago

Any proposal in how we’d handle it?

On Aug 24, 2018, at 7:50 PM, bgarrant notifications@github.com wrote:

Any plans for Structured Data Support?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

bgarrant commented 6 years ago

Just a form of inputs for entity maybe like SEOMatic. I will get a snapshot.

On Aug 24, 2018, at 7:58 PM, Jack McDade notifications@github.com wrote:

Any proposal in how we’d handle it?

On Aug 24, 2018, at 7:50 PM, bgarrant notifications@github.com wrote:

Any plans for Structured Data Support?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/statamic/seo-pro","title":"statamic/seo-pro","subtitle":"GitHub repository","main_image_url":"https://assets-cdn.github.com/images/email/message_cards/header.png","avatar_image_url":"https://assets-cdn.github.com/images/email/message_cards/avatar.png","action":{"name":"Open in GitHub","url":"https://github.com/statamic/seo-pro"}},"updates":{"snippets":[{"icon":"PERSON","message":"@jackmcdade in #28: Any proposal in how we’d handle it? \n\n\u003e On Aug 24, 2018, at 7:50 PM, bgarrant \u003cnotifications@github.com\u003e wrote:\n\u003e \n\u003e Any plans for Structured Data Support?\n\u003e \n\u003e —\n\u003e You are receiving this because you are subscribed to this thread.\n\u003e Reply to this email directly, view it on GitHub, or mute the thread.\n"}],"action":{"name":"View Issue","url":"https://github.com/statamic/seo-pro/issues/28#issuecomment-415911231"}}} [ { "@context": "http://schema.org", "@type": "EmailMessage", "potentialAction": { "@type": "ViewAction", "target": "https://github.com/statamic/seo-pro/issues/28#issuecomment-415911231", "url": "https://github.com/statamic/seo-pro/issues/28#issuecomment-415911231", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { "@type": "Organization", "name": "GitHub", "url": "https://github.com" } }, { "@type": "MessageCard", "@context": "http://schema.org/extensions", "hideOriginalBody": "false", "originator": "AF6C5A86-E920-430C-9C59-A73278B5EFEB", "title": "Re: [statamic/seo-pro] Structured Data (#28)", "sections": [ { "text": "", "activityTitle": "Jack McDade", "activityImage": "https://assets-cdn.github.com/images/email/message_cards/avatar.png", "activitySubtitle": "@jackmcdade", "facts": [ ] } ], "potentialAction": [ { "name": "Add a comment", "@type": "ActionCard", "inputs": [ { "isMultiLine": true, "@type": "TextInput", "id": "IssueComment", "isRequired": false } ], "actions": [ { "name": "Comment", "@type": "HttpPOST", "target": "https://api.github.com", "body": "{\n\"commandName\": \"IssueComment\",\n\"repositoryFullName\": \"statamic/seo-pro\",\n\"issueId\": 28,\n\"IssueComment\": \"{{IssueComment.value}}\"\n}" } ] }, { "name": "Close issue", "@type": "HttpPOST", "target": "https://api.github.com", "body": "{\n\"commandName\": \"IssueClose\",\n\"repositoryFullName\": \"statamic/seo-pro\",\n\"issueId\": 28\n}" }, { "targets": [ { "os": "default", "uri": "https://github.com/statamic/seo-pro/issues/28#issuecomment-415911231" } ], "@type": "OpenUri", "name": "View on GitHub" }, { "name": "Unsubscribe", "@type": "HttpPOST", "target": "https://api.github.com", "body": "{\n\"commandName\": \"MuteNotification\",\n\"threadId\": 372281101\n}" } ], "themeColor": "26292E" } ]

bgarrant commented 6 years ago

f28b7a9f-a7c5-4a4c-b0aa-379791a7cbe9

kodeine commented 5 years ago

interested in this as well.

bgarrant commented 5 years ago

We could really use this https://developers.google.com/search/docs/guides/intro-structured-data

pmeissner commented 4 years ago

A lo-fi way to implement would be a simple textarea in the Section Defaults configuration page to place the code. Why?

  1. Creating the proper JSON+LD script takes hand-coding — sometimes you're looping through social media properties, sometimes your pulling data from a related collection, sometimes your combining and modifying variables, sometimes there are conditionals. I'm not sure it's the best place for a UI.

  2. Placing the code into a template and then section/yield it to the <head> works, BUT it makes sense to have it in the SEOPro Section Defaults because it's SEO related, a collection is a particular kind of content (Reviews/Articles/Posts/Persons/Location), and if you have an SEO expert on the team, they can fiddle with the code, keeping them out of the templates.

Some things could possibly be generated by Statamic — ex. breadcrumbs. Maybe a nice feature would be a visualizer to see the output and a list of available variable from the collection/section.

gerardw85 commented 2 years ago

Was anything ever shipped to address this? I've been researching Statamic's SEO capabilities and I can't find anything regarding structured data - was hoping this add on addresses structured data like Yoast does in WP.

danpastori commented 2 years ago

I've been working with SEO pro and love it! I would also like to have a structured data tag, so I made one myself.

Essentially it comes down to using a lot of the defaults provided by SEO Pro with a few extra fields mixed in. If interested, I'd submit a PR on how I'd approach this within the SEO Pro Package.

The approach I'd take is adding a tag seo_pro:structured_data similar to seo_pro:custom_meta. I'd then add the extra fields necessary (structured data object type, some basic settings for the author, etc.) and then generate the JSON-LD based off of the context of where it's referenced. I'd do it similar to Yoast 11.0 where it was grouped in a @graph key with referencing @id's

Examples: Entry that has type "Article" -> Generate a JSON-LD structure with the article fields. I already have the Word Count computed in an extra plugin.

Home Page -> Basic organization level structured data, search function, etc.

If this is of interest, I have this working and would be willing to create a PR and work with the team to bring this to life. Thoughts? @jackmcdade