diff --git a/src/theme/DocItem/index.js b/src/theme/DocItem/index.js index 9e040ed8d..72cc5de8e 100644 --- a/src/theme/DocItem/index.js +++ b/src/theme/DocItem/index.js @@ -159,8 +159,9 @@ export default function DocItem(props) { // Versioned root pattern: /docs// or /docs/ where // starts with a digit. Covers current and archived // versions listed in docusaurus.config.js onlyIncludeVersions. - const isVersionedDocsRoot = - /^\/docs\/\d[\w.-]*(?:\/index)?\/?$/.test(permalink); + const isVersionedDocsRoot = /^\/docs\/\d[\w.-]*(?:\/index)?\/?$/.test( + permalink + ); const isDocsRoot = permalink === "/docs/" || permalink === "/docs" || @@ -179,9 +180,24 @@ export default function DocItem(props) { headline: title, description, ...(modifiedTime ? {dateModified: modifiedTime} : {}), - ...(publishedTime ? {datePublished: publishedTime} : {}), + // datePublished falls back to the last-modified time so every doc + // carries a freshness signal even when front matter omits `date`. + ...(publishedTime || modifiedTime + ? {datePublished: publishedTime || modifiedTime} + : {}), ...(keywords ? {keywords} : {}), - ...(authorList.length ? {author: authorList} : {}), + // Default author to the Keploy organization when a doc has no + // front-matter author, so Article schema always carries an author + // (E-E-A-T) instead of dropping the field entirely. + ...(authorList.length + ? {author: authorList} + : { + author: { + "@type": "Organization", + name: "Keploy", + url: "https://keploy.io", + }, + }), ...(combinedContributors.length ? {contributor: combinedContributors} : {}), @@ -327,10 +343,7 @@ export default function DocItem(props) { - +