New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@antora/redirect-producer

Package Overview
Dependencies
Maintainers
2
Versions
80
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@antora/redirect-producer - npm Package Compare versions

Comparing version 2.1.0 to 2.1.1

25

lib/produce-redirects.js

@@ -36,3 +36,6 @@ 'use strict'

let siteUrl = playbook.site.url
if (siteUrl && siteUrl.charAt(siteUrl.length - 1) === '/') siteUrl = siteUrl.substr(0, siteUrl.length - 1)
if (siteUrl) {
if (siteUrl === '/') siteUrl = ''
else if (siteUrl.charAt(siteUrl.length - 1) === '/') siteUrl = siteUrl.substr(0, siteUrl.length - 1)
}
switch (playbook.urls.redirectFacility) {

@@ -55,4 +58,8 @@ case 'static':

function extractUrlPath (url) {
let urlPath
return url && (urlPath = new URL(url).pathname) === '/' ? '' : urlPath
if (url) {
if (url.charAt() === '/') return url
const urlPath = new URL(url).pathname
return urlPath === '/' ? '' : urlPath
}
return ''
}

@@ -68,3 +75,3 @@

function createNetlifyRedirects (files, urlPath = '', includeDirectoryRedirects = false) {
function createNetlifyRedirects (files, urlPath, includeDirectoryRedirects = false) {
const rules = files.reduce((accum, file) => {

@@ -85,3 +92,3 @@ delete file.out

function createNginxRewriteConf (files, urlPath = '') {
function createNginxRewriteConf (files, urlPath) {
const rules = files.map((file) => {

@@ -108,7 +115,7 @@ delete file.out

const relativeUrl = computeRelativeUrlPath(file.pub.url, targetUrl)
const canonicalUrl = siteUrl ? siteUrl + targetUrl : undefined
const canonicalLink = siteUrl ? `\n<link rel="canonical" href="${canonicalUrl}">` : ''
const canonicalUrl = siteUrl && siteUrl.charAt() !== '/' ? siteUrl + targetUrl : undefined
const canonicalLink = canonicalUrl ? `<link rel="canonical" href="${canonicalUrl}">\n` : ''
return Buffer.from(`<!DOCTYPE html>
<meta charset="utf-8">${canonicalLink}
<script>location="${relativeUrl}"</script>
<meta charset="utf-8">
${canonicalLink}<script>location="${relativeUrl}"</script>
<meta http-equiv="refresh" content="0; url=${relativeUrl}">

@@ -115,0 +122,0 @@ <meta name="robots" content="noindex">

{
"name": "@antora/redirect-producer",
"version": "2.1.0",
"version": "2.1.1",
"description": "Produces redirects (HTTP redirections) for pages in an Antora site.",

@@ -18,3 +18,3 @@ "license": "MPL-2.0",

"dependencies": {
"@antora/asciidoc-loader": "2.1.0",
"@antora/asciidoc-loader": "2.1.1",
"vinyl": "~2.2"

@@ -21,0 +21,0 @@ },

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc