hono icon indicating copy to clipboard operation
hono copied to clipboard

Feature to Create a Sitemap

Open watany-dev opened this issue 1 year ago • 12 comments

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)

watany-dev avatar Jan 31 '24 11:01 watany-dev

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

yusukebe avatar Jan 31 '24 23:01 yusukebe