Skip to content

Feat(seo): extend SEO with article metadata#178

Merged
vancura merged 1 commit intomainfrom
al-280-use-ogtype-article-and-article-meta-tags-for-news-posts
Feb 10, 2026
Merged

Feat(seo): extend SEO with article metadata#178
vancura merged 1 commit intomainfrom
al-280-use-ogtype-article-and-article-meta-tags-for-news-posts

Conversation

@vancura
Copy link
Copy Markdown
Collaborator

@vancura vancura commented Feb 10, 2026

  • 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

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)

  • Added optional article metadata props: articlePublishedTime, articleModifiedTime, articleAuthor, articleSection, articleTags.
  • Introduced isArticle (true when articlePublishedTime is provided).
  • Made og:type dynamic: renders "article" when isArticle is true, otherwise "website".
  • Conditionally emits Open Graph article tags when 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 in articleTags)
  • Preserves existing Open Graph, Twitter, and standard meta tags for non-article pages.

NewsPostLayout Component (src/components/astro/NewsPostLayout.astro)

  • Imports SITE config and constructs an articleMetadata object mapping post data:
    • articlePublishedTimepubDate
    • articleModifiedTimeupdatedDate (when present)
    • articleAuthorSITE.AUTHOR
    • articleSection ← translated news section title
    • articleTagstags
  • Spreads articleMetadata into PageLayout props so metadata flows: NewsPostLayout → PageLayout → Head → BaseHead.

SEO Type Definition (src/types/seo.ts)

  • Extended ISEOMetadata with optional fields:
    • articleAuthor?: string
    • articleSection?: string
    • articleTags?: string[]
  • (articlePublishedTime and articleModifiedTime are also present/used by the components.)

Behavioral Impact

  • News posts render og:type="article" and include Open Graph article tags (published_time, modified_time, author, section, tags) when article metadata is provided.
  • Regular pages continue to use og:type="website" and unchanged meta output.
  • Props now flow from NewsPostLayout through PageLayout and Head into BaseHead, meeting the acceptance criteria for metadata propagation.

@linear
Copy link
Copy Markdown

linear bot commented Feb 10, 2026

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Feb 10, 2026

📝 Walkthrough

Walkthrough

Adds 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

Cohort / File(s) Summary
Type Definitions
src/types/seo.ts
Added optional articleAuthor?: string, articleSection?: string, and articleTags?: string[] to ISEOMetadata.
Head component
src/components/astro/BaseHead.astro
Destructures new article props (articlePublishedTime, articleModifiedTime, articleAuthor, articleSection, articleTags); computes isArticle from articlePublishedTime; sets og:type to "article" when isArticle; conditionally renders article:published_time, article:modified_time, article:author, article:section, and one article:tag meta per tag.
Layout wiring
src/components/astro/NewsPostLayout.astro
Imports site author and constructs articleMetadata (published/modified time, author, section, tags) then spreads it into PageLayout props so BaseHead receives article fields.

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
Loading

Possibly related issues

  • AL-280: Use og:type "article" and article meta tags for news posts — This PR implements dynamic og:type for articles and emits article:* meta tags, and wires article fields from NewsPostLayout into PageLayout/BaseHead, matching the ticket objectives.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: extending SEO functionality with article metadata support.
Linked Issues check ✅ Passed The pull request implements all acceptance criteria from AL-280: og:type is now dynamic (article/website), article meta tags are rendered when article metadata is present, and props flow correctly through the component hierarchy.
Out of Scope Changes check ✅ Passed All changes are scoped to AL-280 requirements: extending SEO metadata interfaces and implementing article meta tag rendering for news posts without introducing unrelated modifications.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch al-280-use-ogtype-article-and-article-meta-tags-for-news-posts

No actionable comments were generated in the recent review. 🎉


Comment @coderabbitai help to get the list of available commands and usage tips.

- 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>
@vancura vancura force-pushed the al-280-use-ogtype-article-and-article-meta-tags-for-news-posts branch from 7da27d2 to 5af7886 Compare February 10, 2026 08:46
@vancura vancura merged commit 481fe54 into main Feb 10, 2026
6 checks passed
@vancura vancura deleted the al-280-use-ogtype-article-and-article-meta-tags-for-news-posts branch February 10, 2026 08:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant