hono
hono copied to clipboard
Feature to Create a Sitemap
What is the feature you are proposing?
We will add a feature to create a sitemap, such as toSitemap, generateSitemap. This is needed when operating a site generated through Static Site Generation (SSG).
※It won't be ready by February 9th. :)
Usage
If you are only targeting the results of SSG, this should suffice:
toSSG(app, fs, {
afterGenerateHook: (result) => {
if (result.files) {
SSGToSitemap(result.files, fs, sitemapOptions)
}
}
})
If there is a mix of SSG and other content, you would use it like this:
toSitemap(app, fs, sitemapOptions)
Hi @watany-dev
How about creating a Plugin system for the future?
import { sitemap } from 'hono/ssg/sitemap'
import { robotsTxt } from 'community-plugin-robots-txt'
toSSG(app, fs, {
plugins: [sitemap(), robotsTxt()],
})
export default app