diff options
| author | trisusilo48 <tri.susilo@altama.co.id> | 2024-12-09 13:58:37 +0700 |
|---|---|---|
| committer | trisusilo48 <tri.susilo@altama.co.id> | 2024-12-09 13:58:37 +0700 |
| commit | bb118223e541504262da4509e9188610539702fe (patch) | |
| tree | c9a11dd679df3d53f384a188b5208f6ac8259331 /src | |
| parent | a382c261cd1a77acb0b8d21175c857d6da61c81f (diff) | |
sitemaps homepage
Diffstat (limited to 'src')
| -rw-r--r-- | src/pages/sitemap/homepage.xml.js | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/pages/sitemap/homepage.xml.js b/src/pages/sitemap/homepage.xml.js new file mode 100644 index 00000000..08c52112 --- /dev/null +++ b/src/pages/sitemap/homepage.xml.js @@ -0,0 +1,33 @@ +import { create } from 'xmlbuilder'; + +export async function getServerSideProps({ res }) { + const links = [ + { label: 'Hubungi Kami', url: 'https://indoteknik.com/hubungi-kami' }, + { label: 'Tentang Kami', url: 'https://indoteknik.com/tentang-kami' }, + { label: 'Karir', url: 'https://indoteknik.com/karir' }, + { label: 'Daftar Tempo', url: 'https://indoteknik.com/my/pembayaran-tempo' }, + ]; + const sitemap = create('urlset', { encoding: 'utf-8' }).att( + 'xmlns', + 'http://www.sitemaps.org/schemas/sitemap/0.9' + ) + + const date = new Date() + links.forEach((link) => { + const url = sitemap.ele('url') + url.ele('loc', link.url) + url.ele('lastmod', date.toISOString().slice(0, 10)) + url.ele('changefreq', 'daily') + url.ele('priority', '1.0') + }) + + res.setHeader('Content-Type', 'text/xml') + res.write(sitemap.end()) + res.end() + + return { props: {} } +} + +export default function SitemapProducts() { + return null +} |
