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",
"@fortawesome/fontawesome-free": "5.15.4",
"@lingdocs/lingdocs-main": "^0.3.3",
"@lingdocs/ps-react": "^7.0.9",
"@lingdocs/ps-react": "^6.0.12",
"@mdx-js/rollup": "^2.2.1",
"@stefanprobst/rehype-extract-toc": "^2.2.0",
"@types/mdx": "^2.0.3",

View File

@ -1,4 +1,3 @@
# https://www.robotstxt.org/robotstxt.html
User-agent: *
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 contentTreeRaw = indexText.split("/* content-tree */")[1];
const safeContentTreeText = contentTreeRaw
.split("\n")
.filter((l) => !l.includes(`"import":`))
.join("\n");
.split("\n")
.filter(l => !l.includes(`"import":`))
.join("\n");
const contentTree = JSON.parse(safeContentTreeText);
const urls = contentTree.reduce(
(acc, section) => {
const urls = contentTree.reduce((acc, section) => {
if ("slug" in section) {
return [...acc, `${base}/${section.slug}/`];
return [
...acc,
`${base}/${section.slug}`,
];
} else {
return [
...acc,
...section.chapters.map(
(x) => `${base}/${section.subdirectory}/${x.slug}/`
),
];
return [
...acc,
...section.chapters.map(x => `${base}/${section.subdirectory}/${x.slug}`),
];
}
},
[`${base}`]
);
}, [base]);
const siteMap = `<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
${urls
.map(
(u) => ` <url>
${urls.map(u => ` <url>
<loc>${u}</loc>
</url>
`
)
.join("")}
`).join("")}
</urlset>
`;
`
fs.writeFileSync("./public/sitemap.xml", siteMap);

View File

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