Compare commits

..

No commits in common. "5e9524153aaac96477ef8c31d981f898d3f25d36" and "18ecac999035723a0885191678af62d941d8520c" have entirely different histories.

4 changed files with 21 additions and 28 deletions

View File

@ -17,7 +17,7 @@
"@formkit/auto-animate": "^1.0.0-beta.6", "@formkit/auto-animate": "^1.0.0-beta.6",
"@fortawesome/fontawesome-free": "5.15.4", "@fortawesome/fontawesome-free": "5.15.4",
"@lingdocs/lingdocs-main": "^0.3.3", "@lingdocs/lingdocs-main": "^0.3.3",
"@lingdocs/ps-react": "^7.0.9", "@lingdocs/ps-react": "^6.0.12",
"@mdx-js/rollup": "^2.2.1", "@mdx-js/rollup": "^2.2.1",
"@stefanprobst/rehype-extract-toc": "^2.2.0", "@stefanprobst/rehype-extract-toc": "^2.2.0",
"@types/mdx": "^2.0.3", "@types/mdx": "^2.0.3",

View File

@ -1,4 +1,3 @@
# https://www.robotstxt.org/robotstxt.html # https://www.robotstxt.org/robotstxt.html
User-agent: * User-agent: *
Disallow: Disallow:
Sitemap: https://grammar.lingdocs.com/sitemap.xml

View File

@ -7,38 +7,32 @@ console.log("generating sitemap.xml");
const indexText = fs.readFileSync("./src/content/index.ts", "utf-8"); const indexText = fs.readFileSync("./src/content/index.ts", "utf-8");
const contentTreeRaw = indexText.split("/* content-tree */")[1]; const contentTreeRaw = indexText.split("/* content-tree */")[1];
const safeContentTreeText = contentTreeRaw const safeContentTreeText = contentTreeRaw
.split("\n") .split("\n")
.filter((l) => !l.includes(`"import":`)) .filter(l => !l.includes(`"import":`))
.join("\n"); .join("\n");
const contentTree = JSON.parse(safeContentTreeText); const contentTree = JSON.parse(safeContentTreeText);
const urls = contentTree.reduce( const urls = contentTree.reduce((acc, section) => {
(acc, section) => {
if ("slug" in section) { if ("slug" in section) {
return [...acc, `${base}/${section.slug}/`]; return [
...acc,
`${base}/${section.slug}`,
];
} else { } else {
return [ return [
...acc, ...acc,
...section.chapters.map( ...section.chapters.map(x => `${base}/${section.subdirectory}/${x.slug}`),
(x) => `${base}/${section.subdirectory}/${x.slug}/` ];
),
];
} }
}, }, [base]);
[`${base}`]
);
const siteMap = `<?xml version="1.0" encoding="UTF-8"?> const siteMap = `<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
${urls ${urls.map(u => ` <url>
.map(
(u) => ` <url>
<loc>${u}</loc> <loc>${u}</loc>
</url> </url>
` `).join("")}
)
.join("")}
</urlset> </urlset>
`; `
fs.writeFileSync("./public/sitemap.xml", siteMap); fs.writeFileSync("./public/sitemap.xml", siteMap);

View File

@ -1377,10 +1377,10 @@
rambda "^6.7.0" rambda "^6.7.0"
react-select "^5.2.2" react-select "^5.2.2"
"@lingdocs/ps-react@^7.0.9": "@lingdocs/ps-react@^6.0.12":
version "7.0.9" version "6.0.12"
resolved "https://npm.lingdocs.com/@lingdocs/ps-react/-/ps-react-7.0.9.tgz#e4e378a37a5438674381e0258c26f7382e73a011" resolved "https://npm.lingdocs.com/@lingdocs/ps-react/-/ps-react-6.0.12.tgz#526a962c06ec59bc86884936e8c5bbea43f64461"
integrity sha512-80fQRnLvTMhmwgSFxkOM5kncJqRAxcvdX3FsUYJIP+i1aC9GvPgNKq5JzBu+CBVKZByTQK9cLUv9qAZ+TOgIxw== integrity sha512-ncOccEYU40woDK7ChyBwtdyiIKrWqAVIlTiIeVGkKa1w6mq14P02SZFCvbqnjJ54pBIK8r0VXRj0LcYkmZn4rw==
dependencies: dependencies:
"@formkit/auto-animate" "^1.0.0-beta.3" "@formkit/auto-animate" "^1.0.0-beta.3"
classnames "^2.2.6" classnames "^2.2.6"