MCPcopy Create free account
hub / github.com/BrasilAPI/BrasilAPI / getServerSideProps

Function getServerSideProps

pages/sitemap.xml/index.jsx:34–67  ·  view source on GitHub ↗
(context)

Source from the content-addressed store, hash-verified

32const buildDate = getDate();
33
34export 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
70const Component = () => {};

Callers

nothing calls this directly

Calls 2

getDateFunction · 0.85
getDocsFunction · 0.85

Tested by

no test coverage detected