Exifly / ApiVault

Your gateway to a world of public APIs.
https://apivault.dev
Other
435 stars 39 forks source link

Fix/sitemap robots for SEO #202

Closed gdjohn4s closed 1 year ago

gdjohn4s commented 1 year ago

Description

Apivault has dynamic robots/sitemap generation now for better indexing on search engines.

Proposed Changes

The robots config is:

export default [
  { UserAgent: '*' },
  { Disallow: '/' },
  { BlankLine: true },

  { Sitemap: () => 'https://apivault.dev/sitemap.xml' }
]

Additional Information

We are using the simplest config for now, preparing all dynamic routes inside nuxt.config.ts:

  sitemap: {
    siteUrl: 'https://apivault.dev',
    urls: async () => {
      return categoriesProperties.map(category => ({
        loc: `/categories/${category.name}`,
        lastmod: new Date(),
        changefreq: 'daily',
        priority: 0.2,
      }))
    },
    defaults: {
      changefreq: 'daily',
      priority: 0.5,
      lastmod: new Date()
    }
  },

We should change this using modules in the future, when apivault will become bigger.

Checklist