Skip to content

fix(theme-classic): blog post footer not rendered when only last_update is set#11841

Open
akshatsinha0 wants to merge 1 commit intofacebook:mainfrom
akshatsinha0:fix/blog-post-item-footer-last-update
Open

fix(theme-classic): blog post footer not rendered when only last_update is set#11841
akshatsinha0 wants to merge 1 commit intofacebook:mainfrom
akshatsinha0:fix/blog-post-item-footer-last-update

Conversation

@akshatsinha0
Copy link
Copy Markdown
Contributor

@akshatsinha0 akshatsinha0 commented Mar 26, 2026

Pre-flight checklist

  • I have read the Contributing Guidelines on pull requests.
  • If this is a code change: I have written unit tests and/or added dogfooding pages to fully verify the new behavior.
  • If this is a new API or substantial change: the PR has an accompanying issue (closes #0000) and the maintainers have approved on my working plan.

Motivation

BlogPostItemFooter returns null on the blog post page when the post has no tags, no editUrl, but has last_update configured in front matter. The lastUpdatedAt and lastUpdatedBy values are absent from the guard condition, so the function returns null before they are ever evaluated.

The root cause is the outer guard in BlogPostItem/Footer/index.tsx:

const renderFooter = tagsExists || truncatedPost || editUrl;

truncatedPost is always false on the post page (!isBlogPostPage && hasTruncateMarker), so this reduces to tagsExists || editUrl. lastUpdatedAt and lastUpdatedBy are absent from the condition, so the function returns null before the inner canDisplayEditMetaRow check at line 40 is ever reached.

DocItem/Footer/index.tsx does not have this problem. Its guard is:

const canDisplayFooter = canDisplayTagsRow || canDisplayEditMetaRow;
// where:
const canDisplayEditMetaRow = !!(editUrl || lastUpdatedAt || lastUpdatedBy);

This is a feature parity gap between the docs and blog footers.

Fix: align renderFooter with the existing canDisplayEditMetaRow condition that was already correct:

const renderFooter =
  tagsExists || truncatedPost || !!(editUrl || lastUpdatedAt || lastUpdatedBy);

Test Plan

Add a blog post with only last_update set (no tags, no custom_edit_url):

---
title: Test last_update visibility
last_update:
  date: 2026-01-01
  author: Akshat Sinha
---
Content.

After running yarn workspace website start, to navigate to the post page.

Before this fix: the footer section is absent entirely.
After this fix: "Last updated on Jan 1, 2026 by Akshat Sinha" renders correctly.

Test links

Deploy preview: https://deploy-preview-11841--docusaurus-2.netlify.app/

Related issues/PRs

No related issues found.

@meta-cla meta-cla bot added the CLA Signed Signed Facebook CLA label Mar 26, 2026
@netlify
Copy link
Copy Markdown

netlify bot commented Mar 26, 2026

[V2]

Built without sensitive environment variables

Name Link
🔨 Latest commit 277844d
🔍 Latest deploy log https://app.netlify.com/projects/docusaurus-2/deploys/69c4ebf23d6b3c00086fc75c
😎 Deploy Preview https://deploy-preview-11841--docusaurus-2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed Signed Facebook CLA

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant