File tree Expand file tree Collapse file tree 3 files changed +10
-1
lines changed
Expand file tree Collapse file tree 3 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ export interface Props {
3030 link? : object []
3131 structuredData? : object []
3232 pubDate? : Date
33+ modifiedDate? : Date
3334}
3435
3536const {
@@ -42,6 +43,7 @@ const {
4243 link = [],
4344 structuredData = [],
4445 pubDate,
46+ modifiedDate,
4547} = Astro .props
4648
4749const canonicalUrl = new URL (Astro .url .pathname , Astro .site ).toString ()
@@ -129,6 +131,7 @@ import "../styles/global.css"
129131 },
130132 article: pubDate ? {
131133 publishedTime: pubDate .toISOString (),
134+ modifiedTime: modifiedDate ? modifiedDate .toISOString () : undefined ,
132135 } : undefined ,
133136 }}
134137 extend ={ {
Original file line number Diff line number Diff line change @@ -77,10 +77,15 @@ export default function searchIndex(config) {
7777 )
7878 const ogTitleValue = ogTitleTag . getAttribute ( "content" )
7979
80+ const articleModifiedTag = postDocument . querySelector (
81+ "meta[property='article:modified_time']"
82+ )
8083 const articlePublishedTag = postDocument . querySelector (
8184 "meta[property='article:published_time']"
8285 )
83- const publishedDate = articlePublishedTag
86+ const publishedDate = articleModifiedTag
87+ ? articleModifiedTag . getAttribute ( "content" )
88+ : articlePublishedTag
8489 ? articlePublishedTag . getAttribute ( "content" )
8590 : null
8691
Original file line number Diff line number Diff line change @@ -84,6 +84,7 @@ const blogPostSchema = [
8484 ogImageAlt ={ hasFeatureImage ? entry .data .featureImage .alt : null }
8585 structuredData ={ blogPostSchema }
8686 pubDate ={ entry .data .pubDate }
87+ modifiedDate ={ entry .data .modifiedDate }
8788>
8889 <main class =" max-w-4xl mx-auto mb-24" >
8990 <Heading
You can’t perform that action at this time.
0 commit comments