1
0
mirror of synced 2025-12-22 11:26:57 -05:00

Decouple redirects from language (#24597)

* experimenting with redirects

* cleanup developer.json

* wip

* clean console.log

* progress

* some progress

* progress

* much progress

* debugging tests

* hacky progress

* ditch latest -> number redirects

* minor

* hacky progress

* lots of progress

* some small fixes

* fix rendering tests

* small fixes

* progress

* undo debugging

* better

* routing tests OK

* more cleaning

* unit tests

* undoing lineending edit

* undoing temporary debugging

* don't ever set this.redirects on Page

* cope with archived version redirects

* adding code comments on the major if statements

* address all feedback

* update README about redirects

* delete invalid test

* fix feedback
This commit is contained in:
Peter Bengtsson
2022-02-14 15:19:10 -05:00
committed by GitHub
parent b381520839
commit 07c8fc3c2a
29 changed files with 5169 additions and 14292 deletions

View File

@@ -13,9 +13,12 @@ class Permalink {
const permalinkSuffix = this.constructor.relativePathToSuffix(relativePath)
this.href = removeFPTFromPath(
path.posix.join('/', languageCode, pageVersion, permalinkSuffix)
this.hrefWithoutLanguage = removeFPTFromPath(
path.posix.join('/', pageVersion, permalinkSuffix)
).replace(patterns.trailingSlash, '$1')
this.href = `/${languageCode}${
this.hrefWithoutLanguage === '/' ? '' : this.hrefWithoutLanguage
}`
this.pageVersionTitle = allVersions[pageVersion].versionTitle