(languageCode, pageVersion, relativePath, title)
| 29 | */ |
| 30 | class Permalink { |
| 31 | constructor(languageCode, pageVersion, relativePath, title) { |
| 32 | this.languageCode = languageCode |
| 33 | this.pageVersion = pageVersion |
| 34 | this.relativePath = relativePath |
| 35 | this.title = title |
| 36 | |
| 37 | const permalinkSuffix = this.constructor.relativePathToSuffix(relativePath) |
| 38 | |
| 39 | this.hrefWithoutLanguage = removeFPTFromPath( |
| 40 | path.posix.join('/', pageVersion, permalinkSuffix) |
| 41 | ).replace(patterns.trailingSlash, '$1') |
| 42 | this.href = `/${languageCode}${ |
| 43 | this.hrefWithoutLanguage === '/' ? '' : this.hrefWithoutLanguage |
| 44 | }` |
| 45 | |
| 46 | return this |
| 47 | } |
| 48 | |
| 49 | static derive(languageCode, relativePath, title, applicableVersions) { |
| 50 | assert(relativePath, 'relativePath is required') |
nothing calls this directly
no test coverage detected