Skip to content

Commit b92b16b

Browse files
committed
if no latest use page version if set
1 parent b968cd3 commit b92b16b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/helpers/neo-canonical-current.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,14 @@
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

913
module.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')}/`

0 commit comments

Comments
 (0)