| 32 | const buildDate = getDate(); |
| 33 | |
| 34 | export const getServerSideProps = async (context) => { |
| 35 | const currentDate = getDate(); |
| 36 | |
| 37 | const tagsDoc = getDocs(); |
| 38 | |
| 39 | const staticPaths = [ |
| 40 | { |
| 41 | loc: `${BASE_URL}`, |
| 42 | lastmod: buildDate, |
| 43 | changefreq: 'weekly', |
| 44 | priority: '1', |
| 45 | }, |
| 46 | { |
| 47 | loc: `${BASE_URL}/docs`, |
| 48 | lastmod: buildDate, |
| 49 | changefreq: 'weekly', |
| 50 | priority: '0.9', |
| 51 | }, |
| 52 | ]; |
| 53 | |
| 54 | const docs = tagsDoc.map((tag) => ({ |
| 55 | loc: `${BASE_URL}/docs#tag/${tag}`, |
| 56 | lastmod: currentDate, |
| 57 | changefreq: 'monthly', |
| 58 | priority: '0.8', |
| 59 | })); |
| 60 | |
| 61 | context.res.setHeader( |
| 62 | 'Cache-Control', |
| 63 | `max-age=0, s-maxage=${sMaxAge}, stale-while-revalidate, public` |
| 64 | ); |
| 65 | |
| 66 | return getServerSideSitemap(context, staticPaths.concat(docs)); |
| 67 | }; |
| 68 | |
| 69 | // Default export to prevent next.js errors |
| 70 | const Component = () => {}; |