File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change 44// we want to modify the canonical by replacing that version with 'current'
55// we can allow for a page attribute to be set to override 'current'
66
7+ // if there's only one version of the page, there is no page.latest
8+ // if the version is ~ there is no version in the path
9+ // if both of these are true, we return the canonical URL as is
10+
711'use strict'
812
913module . exports = ( page ) => {
10- if ( ! page . latest && ! page . attributes [ 'use-current-mapping' ] ) return page . canonicalUrl
14+ if ( ! page . latest && ! page . version ) return page . canonicalUrl
1115 const versionToReplace = page . latest ? page . latest . version : page . version
1216 const re = new RegExp ( `/${ versionToReplace } /` )
1317 const latestVersionPath = `/${ ( page . attributes [ 'latest-version-path' ] || 'current' ) } /`
You can’t perform that action at this time.
0 commit comments