mirror of
https://github.com/LukeHagar/unicorn-utterances.git
synced 2025-12-06 04:21:55 +00:00
@@ -20,6 +20,7 @@ import * as path from "path";
|
|||||||
import svgr from "vite-plugin-svgr";
|
import svgr from "vite-plugin-svgr";
|
||||||
import { languages } from "./src/constants/index";
|
import { languages } from "./src/constants/index";
|
||||||
import { fileToOpenGraphConverter } from "./src/utils/translations";
|
import { fileToOpenGraphConverter } from "./src/utils/translations";
|
||||||
|
import { posts } from "./src/utils/data";
|
||||||
|
|
||||||
await symlink(path.resolve("content"), path.resolve("public/content"));
|
await symlink(path.resolve("content"), path.resolve("public/content"));
|
||||||
|
|
||||||
@@ -42,13 +43,17 @@ export default defineConfig({
|
|||||||
}, {}),
|
}, {}),
|
||||||
},
|
},
|
||||||
filter(page) {
|
filter(page) {
|
||||||
// return true, unless lart part of the URL ends with "_noindex"
|
// return true, unless last part of the URL ends with "_noindex"
|
||||||
// in which case it should not be in the sitemap
|
// in which case it should not be in the sitemap
|
||||||
return !page
|
const lastPartOfSlug = page
|
||||||
.split("/")
|
.split("/")
|
||||||
.filter((part) => !!part.length)
|
.filter((part) => !!part.length)
|
||||||
.at(-1)
|
.at(-1);
|
||||||
.endsWith("_noindex");
|
|
||||||
|
if (lastPartOfSlug.endsWith("_noindex")) return false;
|
||||||
|
const relatedPost = posts.find((post) => post.slug === lastPartOfSlug);
|
||||||
|
if (relatedPost && relatedPost.originalLink) return false;
|
||||||
|
return true;
|
||||||
},
|
},
|
||||||
serialize({ url, ...rest }) {
|
serialize({ url, ...rest }) {
|
||||||
return {
|
return {
|
||||||
|
|||||||
Reference in New Issue
Block a user