Feat(seo): extend SEO with article metadata#178
Merged
Conversation
Contributor
📝 WalkthroughWalkthroughAdds optional article metadata fields to SEO types, passes article data from NewsPostLayout into PageLayout, and updates BaseHead to treat pages with articlePublishedTime as articles (og:type "article") and emit corresponding Open Graph/article meta tags and article:tag entries. Changes
Sequence Diagram(s)sequenceDiagram
participant NewsPostLayout as NewsPostLayout
participant PageLayout as PageLayout
participant BaseHead as BaseHead
NewsPostLayout->>PageLayout: render page with {...articleMetadata, otherProps}
PageLayout->>BaseHead: pass props including articlePublishedTime, articleModifiedTime, articleAuthor, articleSection, articleTags
BaseHead->>BaseHead: isArticle = !!articlePublishedTime
alt isArticle
BaseHead->>BaseHead: set og:type = "article"
BaseHead->>Browser: emit meta article:published_time, article:modified_time?, article:author?, article:section?, article:tag*
else not article
BaseHead->>BaseHead: set og:type = "website"
BaseHead->>Browser: emit existing meta tags
end
Possibly related issues
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
No actionable comments were generated in the recent review. 🎉 Comment |
- Extend ISEOMetadata with articleAuthor, articleSection, articleTags - Add articlePublishedTime and articleModifiedTime fields - Render article meta tags in BaseHead when available - Make og:type dynamic based on article presence - Propagate articleMetadata from NewsPostLayout to PageLayout Signed-off-by: Vaclav Vancura <commit@vancura.dev> Co-Authored-By: Claude <noreply@anthropic.com>
7da27d2 to
5af7886
Compare
This was referenced Mar 7, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Overview
This PR extends the SEO metadata pipeline to support Open Graph article tags and dynamic detection of article content for news posts, while preserving existing behavior for regular pages.
Changes
BaseHead Component (
src/components/astro/BaseHead.astro)articlePublishedTime,articleModifiedTime,articleAuthor,articleSection,articleTags.isArticle(true whenarticlePublishedTimeis provided).og:typedynamic: renders"article"whenisArticleis true, otherwise"website".isArticle:article:published_time(required for articles)article:modified_time(if provided)article:author(if provided)article:section(if provided)article:tag(one per tag inarticleTags)NewsPostLayout Component (
src/components/astro/NewsPostLayout.astro)SITEconfig and constructs anarticleMetadataobject mapping post data:articlePublishedTime←pubDatearticleModifiedTime←updatedDate(when present)articleAuthor←SITE.AUTHORarticleSection← translated news section titlearticleTags←tagsarticleMetadataintoPageLayoutprops so metadata flows: NewsPostLayout → PageLayout → Head → BaseHead.SEO Type Definition (
src/types/seo.ts)ISEOMetadatawith optional fields:articleAuthor?: stringarticleSection?: stringarticleTags?: string[]articlePublishedTimeandarticleModifiedTimeare also present/used by the components.)Behavioral Impact
og:type="article"and include Open Graph article tags (published_time, modified_time, author, section, tags) when article metadata is provided.og:type="website"and unchanged meta output.