Fix robots formatting

This commit is contained in:
Dustin Brett 2022-01-23 12:12:26 -08:00
parent adb12b7278
commit 94dbcace8f

View File

@ -5,14 +5,14 @@ const APPS_PATH = "components/apps";
const PUBLIC_PATH = "public";
const INDEXED_FILE_TYPES = new Set([".md", ".whtml"]);
const indexData = [];
const indexData = ["User-agent: *", "Allow: /"];
const createAppIndex = () => {
readdirSync(APPS_PATH).forEach((entry) => {
const stats = statSync(join(APPS_PATH, entry));
if (stats.isDirectory()) {
indexData.push(encodeURI(`/?app=${entry}`));
indexData.push(`Allow: ${encodeURI(`/?app=${entry}`)}`);
}
});
};
@ -25,11 +25,11 @@ const createFileIndex = (path) => {
createFileIndex(join(path, entry));
} else if (INDEXED_FILE_TYPES.has(extname(entry))) {
indexData.push(
encodeURI(
`Allow: ${encodeURI(
`/?url=${join(path, entry)
.replace(PUBLIC_PATH, "")
.replace(/\\/g, "/")}`
)
)}`
);
}
});