refactor: use robots and sitemap metadata
This commit is contained in:
parent
b6dac68f61
commit
54ff8c7b48
874
.yarn/releases/yarn-3.6.1.cjs
vendored
Executable file
874
.yarn/releases/yarn-3.6.1.cjs
vendored
Executable file
File diff suppressed because one or more lines are too long
@ -1 +1,3 @@
|
||||
nodeLinker: node-modules
|
||||
|
||||
yarnPath: .yarn/releases/yarn-3.6.1.cjs
|
||||
|
13
app/robots.ts
Normal file
13
app/robots.ts
Normal file
@ -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,
|
||||
}
|
||||
}
|
18
app/sitemap.ts
Normal file
18
app/sitemap.ts
Normal file
@ -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]
|
||||
}
|
@ -11,6 +11,7 @@ import CustomLink from './Link'
|
||||
|
||||
interface MdxProps {
|
||||
code: string
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
[key: string]: any
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
"scripts": {
|
||||
"start": "next dev",
|
||||
"dev": "cross-env INIT_CWD=$PWD next dev",
|
||||
"build": "cross-env INIT_CWD=$PWD next build && cross-env NODE_OPTIONS='--experimental-json-modules' node -r esbuild-register ./scripts/postbuild.mjs",
|
||||
"build": "cross-env INIT_CWD=$PWD next build && cross-env NODE_OPTIONS='--experimental-json-modules' node ./scripts/postbuild.mjs",
|
||||
"serve": "next start",
|
||||
"analyze": "cross-env ANALYZE=true next build",
|
||||
"lint": "next lint --fix --dir pages --dir components --dir lib --dir layouts --dir scripts"
|
||||
@ -48,7 +48,6 @@
|
||||
"@typescript-eslint/parser": "^5.61.0",
|
||||
"cross-env": "^7.0.3",
|
||||
"dedent": "^0.7.0",
|
||||
"esbuild-register": "3.4.2",
|
||||
"eslint": "^8.43.0",
|
||||
"eslint-config-next": "13.4.7",
|
||||
"eslint-config-prettier": "^8.8.0",
|
||||
@ -78,5 +77,6 @@
|
||||
"*.+(js|jsx|ts|tsx|json|css|md|mdx)": [
|
||||
"prettier --write"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"packageManager": "yarn@3.6.1"
|
||||
}
|
@ -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()
|
||||
|
@ -1,9 +0,0 @@
|
||||
import { generateSitemap } from 'pliny/utils/generate-sitemap.js'
|
||||
import siteMetadata from '../data/siteMetadata.js'
|
||||
import { allBlogs } from '../.contentlayer/generated/index.mjs'
|
||||
|
||||
const sitemap = () => {
|
||||
generateSitemap(siteMetadata.siteUrl, allBlogs)
|
||||
console.log('Sitemap generated...')
|
||||
}
|
||||
export default sitemap
|
34
yarn.lock
34
yarn.lock
@ -4042,9 +4042,9 @@ __metadata:
|
||||
linkType: hard
|
||||
|
||||
"caniuse-lite@npm:^1.0.30001406, caniuse-lite@npm:^1.0.30001464, caniuse-lite@npm:^1.0.30001503":
|
||||
version: 1.0.30001513
|
||||
resolution: "caniuse-lite@npm:1.0.30001513"
|
||||
checksum: 7d783f4f40584e7bdeda3f3abc23ffff21f14c37e1fadf1a6b3d2e299727fe9d5a61096101d9d4e4174f881d4ff4c62204fc41f3bc950f4da1b0edfdea025fa4
|
||||
version: 1.0.30001514
|
||||
resolution: "caniuse-lite@npm:1.0.30001514"
|
||||
checksum: ee2e90fe63cb59fb4a1515eb6b157f1c26d3ccba496b994b0f03088c39c282ee2fb8c160ad7b677ee196b5bb078b23f2f9474c32e4e47724f4d782de92bb8bbe
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@ -5048,17 +5048,6 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"esbuild-register@npm:3.4.2":
|
||||
version: 3.4.2
|
||||
resolution: "esbuild-register@npm:3.4.2"
|
||||
dependencies:
|
||||
debug: ^4.3.4
|
||||
peerDependencies:
|
||||
esbuild: ">=0.12 <1"
|
||||
checksum: f65d1ccb58b1ccbba376efb1fc023abe22731d9b79eead1b0120e57d4413318f063696257a5af637b527fa1d3f009095aa6edb1bf6ff69d637a9ab281fb727b3
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"esbuild-sunos-64@npm:0.15.18":
|
||||
version: 0.15.18
|
||||
resolution: "esbuild-sunos-64@npm:0.15.18"
|
||||
@ -5957,7 +5946,7 @@ __metadata:
|
||||
|
||||
"fsevents@patch:fsevents@~2.3.2#~builtin<compat/fsevents>":
|
||||
version: 2.3.2
|
||||
resolution: "fsevents@patch:fsevents@npm%3A2.3.2#~builtin<compat/fsevents>::version=2.3.2&hash=18f3a7"
|
||||
resolution: "fsevents@patch:fsevents@npm%3A2.3.2#~builtin<compat/fsevents>::version=2.3.2&hash=df0bf1"
|
||||
dependencies:
|
||||
node-gyp: latest
|
||||
conditions: os=darwin
|
||||
@ -6126,8 +6115,8 @@ __metadata:
|
||||
linkType: hard
|
||||
|
||||
"glob@npm:^10.2.2":
|
||||
version: 10.3.2
|
||||
resolution: "glob@npm:10.3.2"
|
||||
version: 10.3.3
|
||||
resolution: "glob@npm:10.3.3"
|
||||
dependencies:
|
||||
foreground-child: ^3.1.0
|
||||
jackspeak: ^2.0.3
|
||||
@ -6136,7 +6125,7 @@ __metadata:
|
||||
path-scurry: ^1.10.1
|
||||
bin:
|
||||
glob: dist/cjs/src/bin.js
|
||||
checksum: 3b4f455192d18eb1cf41a9193c825f594a70323b522f290d4b75191d3e399791f9da1febef339392a9828c03a3bf2b96e0b32cc8efb0068c2b11df585026a367
|
||||
checksum: 29190d3291f422da0cb40b77a72fc8d2c51a36524e99b8bf412548b7676a6627489528b57250429612b6eec2e6fe7826d328451d3e694a9d15e575389308ec53
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@ -10282,7 +10271,7 @@ __metadata:
|
||||
|
||||
"resolve@patch:resolve@^1.1.7#~builtin<compat/resolve>, resolve@patch:resolve@^1.14.2#~builtin<compat/resolve>, resolve@patch:resolve@^1.19.0#~builtin<compat/resolve>, resolve@patch:resolve@^1.22.1#~builtin<compat/resolve>, resolve@patch:resolve@^1.22.2#~builtin<compat/resolve>":
|
||||
version: 1.22.3
|
||||
resolution: "resolve@patch:resolve@npm%3A1.22.3#~builtin<compat/resolve>::version=1.22.3&hash=07638b"
|
||||
resolution: "resolve@patch:resolve@npm%3A1.22.3#~builtin<compat/resolve>::version=1.22.3&hash=c3c19d"
|
||||
dependencies:
|
||||
is-core-module: ^2.12.0
|
||||
path-parse: ^1.0.7
|
||||
@ -10295,7 +10284,7 @@ __metadata:
|
||||
|
||||
"resolve@patch:resolve@^2.0.0-next.4#~builtin<compat/resolve>":
|
||||
version: 2.0.0-next.4
|
||||
resolution: "resolve@patch:resolve@npm%3A2.0.0-next.4#~builtin<compat/resolve>::version=2.0.0-next.4&hash=07638b"
|
||||
resolution: "resolve@patch:resolve@npm%3A2.0.0-next.4#~builtin<compat/resolve>::version=2.0.0-next.4&hash=c3c19d"
|
||||
dependencies:
|
||||
is-core-module: ^2.9.0
|
||||
path-parse: ^1.0.7
|
||||
@ -10974,7 +10963,6 @@ __metadata:
|
||||
cross-env: ^7.0.3
|
||||
dedent: ^0.7.0
|
||||
esbuild: 0.18.11
|
||||
esbuild-register: 3.4.2
|
||||
eslint: ^8.43.0
|
||||
eslint-config-next: 13.4.7
|
||||
eslint-config-prettier: ^8.8.0
|
||||
@ -11290,11 +11278,11 @@ __metadata:
|
||||
|
||||
"typescript@patch:typescript@^5.1.3#~builtin<compat/typescript>":
|
||||
version: 5.1.6
|
||||
resolution: "typescript@patch:typescript@npm%3A5.1.6#~builtin<compat/typescript>::version=5.1.6&hash=7ad353"
|
||||
resolution: "typescript@patch:typescript@npm%3A5.1.6#~builtin<compat/typescript>::version=5.1.6&hash=5da071"
|
||||
bin:
|
||||
tsc: bin/tsc
|
||||
tsserver: bin/tsserver
|
||||
checksum: 21e88b0a0c0226f9cb9fd25b9626fb05b4c0f3fddac521844a13e1f30beb8f14e90bd409a9ac43c812c5946d714d6e0dee12d5d02dfc1c562c5aacfa1f49b606
|
||||
checksum: f53bfe97f7c8b2b6d23cf572750d4e7d1e0c5fff1c36d859d0ec84556a827b8785077bc27676bf7e71fae538e517c3ecc0f37e7f593be913d884805d931bc8be
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user