File tree Expand file tree Collapse file tree 2 files changed +15
-3
lines changed
apps/site/next-data/generators Expand file tree Collapse file tree 2 files changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ describe('generateWebsiteFeeds', () => {
2626 slug : '/post-1' ,
2727 title : 'Post 1' ,
2828 author : 'Author 1' ,
29- date : '2024-02 -18' ,
29+ date : '2025-04 -18' ,
3030 categories : [ 'all' ] ,
3131 } ,
3232 ] ,
@@ -36,6 +36,7 @@ describe('generateWebsiteFeeds', () => {
3636 expect ( result . size ) . toBe ( 3 ) ;
3737
3838 const blogFeed = result . get ( 'blog.xml' ) ;
39+ const expectedDate = new Date ( '2025-04-18' ) ;
3940
4041 expect ( blogFeed . options . id ) . toBe ( 'blog.xml' ) ;
4142 expect ( blogFeed . options . title ) . toBe ( 'Node.js Blog' ) ;
@@ -45,9 +46,10 @@ describe('generateWebsiteFeeds', () => {
4546 expect ( blogFeed . items . length ) . toBe ( 1 ) ;
4647 const feedItem = blogFeed . items [ 0 ] ;
4748 expect ( feedItem . id ) . toBe ( '/post-1' ) ;
49+ expect ( feedItem . guid ) . toBe ( `/post-1?${ expectedDate . getTime ( ) } ` ) ;
4850 expect ( feedItem . title ) . toBe ( 'Post 1' ) ;
4951 expect ( feedItem . author ) . toBe ( 'Author 1' ) ;
50- expect ( feedItem . date ) . toEqual ( new Date ( '2024-02-18' ) ) ;
52+ expect ( feedItem . date ) . toEqual ( expectedDate ) ;
5153 expect ( feedItem . link ) . toBe ( 'https://nodejs.org/en/post-1' ) ;
5254 } ) ;
5355} ) ;
Original file line number Diff line number Diff line change @@ -9,6 +9,11 @@ import { siteConfig } from '../../next.json.mjs';
99// with English locale (which is where the website feeds run)
1010const canonicalUrl = `${ BASE_URL } ${ BASE_PATH } /en` ;
1111
12+ // This is April 16th, 2025, which is around the time that https://github.com/nodejs/nodejs.org/pull/7648
13+ // was merged. This ensures that future article edits are properly timestamped, while also preventing the
14+ // currently-published article GUIDs from changing
15+ const guidTimestampStartDate = 1744662623000 ;
16+
1217/**
1318 * This method generates RSS website feeds based on the current website configuration
1419 * and the current blog data that is available
@@ -35,13 +40,18 @@ const generateWebsiteFeeds = ({ posts }) => {
3540 . filter ( post => post . categories . includes ( category ) )
3641 . map ( post => {
3742 const date = new Date ( post . date ) ;
43+ const time = date . getTime ( ) ;
44+
3845 return {
3946 id : post . slug ,
4047 title : post . title ,
4148 author : post . author ,
4249 date,
4350 link : `${ canonicalUrl } ${ post . slug } ` ,
44- guid : `${ post . slug } ?${ date . getTime ( ) } ` ,
51+ guid :
52+ time > guidTimestampStartDate
53+ ? `${ post . slug } ?${ date . getTime ( ) } `
54+ : post . slug ,
4555 } ;
4656 } ) ;
4757
You can’t perform that action at this time.
0 commit comments