generated from timlrx/tailwind-nextjs-starter-blog
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: use robots and sitemap metadata
- Loading branch information
Showing
9 changed files
with
924 additions
and
38 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
nodeLinker: node-modules | ||
|
||
yarnPath: .yarn/releases/yarn-3.6.1.cjs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { MetadataRoute } from 'next' | ||
import siteMetadata from '@/data/siteMetadata' | ||
|
||
export default function robots(): MetadataRoute.Robots { | ||
return { | ||
rules: { | ||
userAgent: '*', | ||
allow: '/', | ||
}, | ||
sitemap: `${siteMetadata.siteUrl}/sitemap.xml`, | ||
host: siteMetadata.siteUrl, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { MetadataRoute } from 'next' | ||
import { allBlogs } from 'contentlayer/generated' | ||
import siteMetadata from '@/data/siteMetadata' | ||
|
||
export default function sitemap(): MetadataRoute.Sitemap { | ||
const siteUrl = siteMetadata.siteUrl | ||
const blogRoutes = allBlogs.map((post) => ({ | ||
url: `${siteUrl}/${post.path}`, | ||
lastModified: post.lastmod || post.date, | ||
})) | ||
|
||
const routes = ['', 'blog', 'projects', 'tags'].map((route) => ({ | ||
url: `${siteUrl}/${route}`, | ||
lastModified: new Date().toISOString().split('T')[0], | ||
})) | ||
|
||
return [...routes, ...blogRoutes] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,8 @@ | ||
import rss from './rss.mjs' | ||
import sitemap from './sitemap.mjs' | ||
import search from './search.mjs' | ||
|
||
async function postbuild() { | ||
await Promise.all([rss(), sitemap(), search()]) | ||
await Promise.all([rss(), search()]) | ||
} | ||
|
||
postbuild() |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters