Compare commits

...

2 Commits

Author SHA1 Message Date
adueck 5e9524153a update inf 2023-12-25 23:12:59 +04:00
adueck d104f0292b update sitemap 2023-12-25 22:56:43 +04:00
4 changed files with 28 additions and 21 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": "^6.0.12",
"@lingdocs/ps-react": "^7.0.9",
"@mdx-js/rollup": "^2.2.1",
"@stefanprobst/rehype-extract-toc": "^2.2.0",
"@types/mdx": "^2.0.3",

View File

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

View File

@ -8,31 +8,37 @@ 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":`))
.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}`),
...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("")}
</urlset>
`
)
.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@^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==
"@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==
dependencies:
"@formkit/auto-animate" "^1.0.0-beta.3"
classnames "^2.2.6"