-
Notifications
You must be signed in to change notification settings - Fork 16
feat(seo): describe the site with schema.org JSON-LD #12598
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
Open
jd
wants to merge
1
commit into
devs/jd/agentic-readiness/tell-agents-what-mergify-llms-txt--03f7b473
from
devs/jd/agentic-readiness/describe-site-schema-org-json-ld--dd84bc05
+120
−0
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,118 @@ | ||
| --- | ||
| import type { CollectionEntry } from 'astro:content'; | ||
|
|
||
| /** | ||
| * Schema.org JSON-LD describing who Mergify is and what the current page is. | ||
| * | ||
| * Search engines and agents both use this for entity resolution — "who publishes | ||
| * these docs, how do I contact them, what product is this about" — which is | ||
| * otherwise only inferable from prose. Emitted as a single `@graph` so the | ||
| * Organization node is declared once and referenced by the others. | ||
| */ | ||
|
|
||
| export interface Props { | ||
| content: CollectionEntry<'docs'>['data']; | ||
| canonicalURL: URL; | ||
| } | ||
|
|
||
| const { content, canonicalURL } = Astro.props; | ||
| const site = Astro.site?.origin ?? 'https://docs.mergify.com'; | ||
| const isHomepage = canonicalURL.pathname === '/'; | ||
|
|
||
| const organization = { | ||
| '@type': 'Organization', | ||
| '@id': 'https://mergify.com/#organization', | ||
| name: 'Mergify', | ||
| url: 'https://mergify.com/', | ||
| description: | ||
| 'Mergify is a merge queue and CI optimization platform for engineering teams on GitHub.', | ||
| email: 'support@mergify.com', | ||
| address: { | ||
| '@type': 'PostalAddress', | ||
| streetAddress: '15 rue Pierre Lauzeral', | ||
| postalCode: '31400', | ||
| addressLocality: 'Toulouse', | ||
| addressCountry: 'FR', | ||
| }, | ||
| contactPoint: [ | ||
| { | ||
| '@type': 'ContactPoint', | ||
| contactType: 'customer support', | ||
| email: 'support@mergify.com', | ||
| url: `${site}/support/`, | ||
| availableLanguage: ['English', 'French'], | ||
| }, | ||
| { | ||
| '@type': 'ContactPoint', | ||
| contactType: 'sales', | ||
| email: 'sales@mergify.com', | ||
| url: 'https://mergify.com/pricing', | ||
| availableLanguage: ['English', 'French'], | ||
| }, | ||
| ], | ||
| // Identity profiles, for entity reconciliation. Deliberately not derived from | ||
| // `Footer/footer.ts`: that list is what we want people to click, and includes | ||
| // the Slack invite, which is a join link rather than a page that identifies | ||
| // Mergify. GitHub is spelled in the org's canonical casing here — both | ||
| // resolve, but `sameAs` is a claim about identity. | ||
| sameAs: [ | ||
| 'https://github.com/Mergifyio', | ||
| 'https://twitter.com/mergifyio', | ||
| 'https://www.linkedin.com/company/mergify/', | ||
| 'https://www.youtube.com/@mergifyio', | ||
| ], | ||
| }; | ||
|
|
||
| const softwareApplication = { | ||
| '@type': 'SoftwareApplication', | ||
| '@id': 'https://mergify.com/#software', | ||
| name: 'Mergify', | ||
| applicationCategory: 'DeveloperApplication', | ||
| applicationSubCategory: 'Continuous Integration', | ||
| operatingSystem: 'Web-based (SaaS)', | ||
| url: 'https://mergify.com/', | ||
| description: | ||
| 'Merge queue, CI Insights, Test Insights, Merge Protections and stacked pull requests for teams developing on GitHub.', | ||
| publisher: { '@id': organization['@id'] }, | ||
| offers: { | ||
| '@type': 'Offer', | ||
| url: 'https://mergify.com/pricing', | ||
| category: 'SaaS subscription', | ||
| }, | ||
| }; | ||
|
|
||
| const page = isHomepage | ||
| ? { | ||
| '@type': 'WebSite', | ||
| '@id': `${site}/#website`, | ||
| name: 'Mergify Documentation', | ||
| url: `${site}/`, | ||
| description: content.description, | ||
| inLanguage: 'en', | ||
| publisher: { '@id': organization['@id'] }, | ||
| about: { '@id': softwareApplication['@id'] }, | ||
| } | ||
| : { | ||
| '@type': 'TechArticle', | ||
| '@id': `${canonicalURL.href}#article`, | ||
| headline: content.title, | ||
| description: content.description, | ||
| url: canonicalURL.href, | ||
| inLanguage: 'en', | ||
| isPartOf: { '@id': `${site}/#website` }, | ||
| publisher: { '@id': organization['@id'] }, | ||
| about: { '@id': softwareApplication['@id'] }, | ||
| }; | ||
|
|
||
| const graph = { | ||
| '@context': 'https://schema.org', | ||
| '@graph': [organization, softwareApplication, page], | ||
| }; | ||
|
|
||
| // `JSON.stringify` does not escape `<`, so a page whose title or description | ||
| // contained `</script>` would close this tag early and put the rest of the | ||
| // frontmatter into the document as markup. | ||
| const json = JSON.stringify(graph).replace(/</g, '\\u003c'); | ||
| --- | ||
|
|
||
| <script type="application/ld+json" is:inline set:html={json} /> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.