diff options
| author | trisusilo48 <tri.susilo@altama.co.id> | 2024-12-23 11:20:56 +0700 |
|---|---|---|
| committer | trisusilo48 <tri.susilo@altama.co.id> | 2024-12-23 11:20:56 +0700 |
| commit | 21f3d78e6c58d9b509f3ea234af462807ef1301d (patch) | |
| tree | 9bad9467325819888b73a86804222e313c6c9504 /src/pages/sitemap | |
| parent | d1592286eef165533c21d52aec70dbb703cdcfd3 (diff) | |
| parent | 9962d114e590bfc5e6c865489ab4dcd84de81ad9 (diff) | |
Merge branch 'new-release' into feature/integrasi_biteship
Diffstat (limited to 'src/pages/sitemap')
| -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 +} |
