@antora/redirect-producer
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -39,3 +39,7 @@ 'use strict' | ||
case 'netlify': | ||
return createNetlifyRedirects(aliases, extractUrlContext(siteUrl)) | ||
return createNetlifyRedirects( | ||
aliases, | ||
extractUrlContext(siteUrl), | ||
(playbook.urls.htmlExtensionStyle || 'default') === 'default' | ||
) | ||
case 'nginx': | ||
@@ -61,7 +65,11 @@ return createNginxRewriteConf(aliases, extractUrlContext(siteUrl)) | ||
function createNetlifyRedirects (files, urlContext = '') { | ||
const rules = files.map((file) => { | ||
function createNetlifyRedirects (files, urlContext = '', includeDirectoryRedirects = false) { | ||
const rules = files.reduce((accum, file) => { | ||
delete file.out | ||
return `${urlContext}${file.pub.url} ${urlContext}${file.rel.pub.url} 301` | ||
}) | ||
accum.push(`${urlContext}${file.pub.url} ${urlContext}${file.rel.pub.url} 301`) | ||
if (includeDirectoryRedirects && file.pub.url.endsWith('/index.html')) { | ||
accum.push(`${urlContext}${file.pub.url.slice(0, -10)} ${urlContext}${file.rel.pub.url} 301`) | ||
} | ||
return accum | ||
}, []) | ||
const redirectsFile = new File({ | ||
@@ -68,0 +76,0 @@ contents: Buffer.from(rules.join('\n')), |
{ | ||
"name": "@antora/redirect-producer", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Produces redirects (HTTP redirections) for pages in an Antora site.", | ||
@@ -18,4 +18,4 @@ "license": "MPL-2.0", | ||
"dependencies": { | ||
"@antora/asciidoc-loader": "1.0.1", | ||
"vinyl": "^2.1.0" | ||
"@antora/asciidoc-loader": "1.0.2", | ||
"vinyl": "^2.2.0" | ||
}, | ||
@@ -22,0 +22,0 @@ "engines": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6894
112
+ Added@antora/asciidoc-loader@1.0.2(transitive)
- Removed@antora/asciidoc-loader@1.0.1(transitive)
Updatedvinyl@^2.2.0