mirror of
https://github.com/jackyzha0/quartz.git
synced 2025-05-18 22:44:14 +02:00
fix(aliases): prevent alias emitter from infinite redirect
This commit is contained in:
parent
5ccc2dcbba
commit
311f92011f
@ -49,6 +49,12 @@ export const AliasRedirects: QuartzEmitterPlugin = () => ({
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (let slug of slugs) {
|
for (let slug of slugs) {
|
||||||
|
// prevent infinite redirect if permalink is same as fullSlug
|
||||||
|
if (`/${ogSlug}/` == `${slug}`) {
|
||||||
|
console.warn(`AliasRedirects: ${slug} is the same as the original slug`)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
// fix any slugs that have trailing slash
|
// fix any slugs that have trailing slash
|
||||||
if (slug.endsWith("/")) {
|
if (slug.endsWith("/")) {
|
||||||
slug = joinSegments(slug, "index") as FullSlug
|
slug = joinSegments(slug, "index") as FullSlug
|
||||||
|
Loading…
x
Reference in New Issue
Block a user