diff --git a/next-sitemap.config.cjs b/next-sitemap.config.cjs new file mode 100644 index 0000000..e47f671 --- /dev/null +++ b/next-sitemap.config.cjs @@ -0,0 +1,6 @@ +/** @type {import('next-sitemap').IConfig} */ +module.exports = { + siteUrl: process.env.SITE_URL || 'https://www.aaronjy.me', + generateRobotsTxt: true, // (optional) + // ...other options +} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 3918925..008a421 100644 --- a/package-lock.json +++ b/package-lock.json @@ -24,6 +24,7 @@ "frontmatter-markdown-loader": "^3.7.0", "husky": "^9.0.11", "js-yaml": "^4.1.0", + "next-sitemap": "^4.2.3", "showdown": "^2.1.0", "standard": "^17.1.0" } @@ -1057,6 +1058,12 @@ "url": "https://github.com/chalk/chalk?sponsor=1" } }, + "node_modules/@corex/deepmerge": { + "version": "4.0.43", + "resolved": "https://registry.npmjs.org/@corex/deepmerge/-/deepmerge-4.0.43.tgz", + "integrity": "sha512-N8uEMrMPL0cu/bdboEWpQYb/0i2K5Qn8eCsxzOmxSggJbbQte7ljMRoXm917AbntqTGOzdTu+vP3KOOzoC70HQ==", + "dev": true + }, "node_modules/@eslint-community/eslint-utils": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz", @@ -4824,6 +4831,39 @@ "react-dom": ">=16.0.0" } }, + "node_modules/next-sitemap": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/next-sitemap/-/next-sitemap-4.2.3.tgz", + "integrity": "sha512-vjdCxeDuWDzldhCnyFCQipw5bfpl4HmZA7uoo3GAaYGjGgfL4Cxb1CiztPuWGmS+auYs7/8OekRS8C2cjdAsjQ==", + "dev": true, + "funding": [ + { + "url": "https://github.com/iamvishnusankar/next-sitemap.git" + } + ], + "dependencies": { + "@corex/deepmerge": "^4.0.43", + "@next/env": "^13.4.3", + "fast-glob": "^3.2.12", + "minimist": "^1.2.8" + }, + "bin": { + "next-sitemap": "bin/next-sitemap.mjs", + "next-sitemap-cjs": "bin/next-sitemap.cjs" + }, + "engines": { + "node": ">=14.18" + }, + "peerDependencies": { + "next": "*" + } + }, + "node_modules/next-sitemap/node_modules/@next/env": { + "version": "13.5.6", + "resolved": "https://registry.npmjs.org/@next/env/-/env-13.5.6.tgz", + "integrity": "sha512-Yac/bV5sBGkkEXmAX5FWPS9Mmo2rthrOPRQQNfycJPkjUAUclomCPH7QFVCDQ4Mp2k2K1SSM6m0zrxYrOwtFQw==", + "dev": true + }, "node_modules/node-releases": { "version": "2.0.14", "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.14.tgz", diff --git a/package.json b/package.json index d619210..45447ad 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,7 @@ "dev": "next dev", "server": "npx decap-server", "build": "next build", + "postbuild": "next-sitemap --config next-sitemap.config.cjs", "start": "next start", "link": "npx standard", "format": "npx standard --fix", @@ -30,6 +31,7 @@ "frontmatter-markdown-loader": "^3.7.0", "husky": "^9.0.11", "js-yaml": "^4.1.0", + "next-sitemap": "^4.2.3", "showdown": "^2.1.0", "standard": "^17.1.0" } diff --git a/public/robots.txt b/public/robots.txt new file mode 100644 index 0000000..6a8d464 --- /dev/null +++ b/public/robots.txt @@ -0,0 +1,9 @@ +# * +User-agent: * +Allow: / + +# Host +Host: https://www.aaronjy.me + +# Sitemaps +Sitemap: https://www.aaronjy.me/sitemap.xml diff --git a/public/sitemap-0.xml b/public/sitemap-0.xml new file mode 100644 index 0000000..aa86fad --- /dev/null +++ b/public/sitemap-0.xml @@ -0,0 +1,9 @@ + + +https://www.aaronjy.me/2024-03-13T12:46:49.416Zdaily0.7 +https://www.aaronjy.me/cv/2024-03-13T12:46:49.417Zdaily0.7 +https://www.aaronjy.me/fun/2024-03-13T12:46:49.417Zdaily0.7 +https://www.aaronjy.me/writing/2024-03-13T12:46:49.417Zdaily0.7 +https://www.aaronjy.me/fun/javascript-html5-tile-editor/2024-03-13T12:46:49.417Zdaily0.7 +https://www.aaronjy.me/writing/static-site-on-google-cloud/2024-03-13T12:46:49.417Zdaily0.7 + \ No newline at end of file diff --git a/public/sitemap.xml b/public/sitemap.xml new file mode 100644 index 0000000..02435d6 --- /dev/null +++ b/public/sitemap.xml @@ -0,0 +1,4 @@ + + +https://www.aaronjy.me/sitemap-0.xml + \ No newline at end of file diff --git a/src/components/Article/Article.jsx b/src/components/Article/Article.jsx index 647350a..bd0f021 100644 --- a/src/components/Article/Article.jsx +++ b/src/components/Article/Article.jsx @@ -1,8 +1,15 @@ +import { NextSeo } from 'next-seo' import React from 'react' function Article ({ attributes, html }) { return (
+

{attributes.title}

{attributes.desc}