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 3.1.1 to 3.1.2

26

lib/produce-redirects.js

@@ -136,13 +136,20 @@ 'use strict'

const targetUrl = file.rel.pub.url
const relativeUrl = computeRelativeUrlPath(file.pub.url, targetUrl)
const canonicalUrl = siteUrl && siteUrl.charAt() !== '/' ? siteUrl + targetUrl : undefined
const canonicalLink = canonicalUrl ? `<link rel="canonical" href="${canonicalUrl}">\n` : ''
let linkTag
let to = targetUrl.charAt() === '/' ? computeRelativeUrlPath(file.pub.url, targetUrl) : undefined
let toText = to
if (to) {
if (siteUrl && siteUrl.charAt() !== '/') {
linkTag = `<link rel="canonical" href="${(toText = siteUrl + targetUrl)}">\n`
}
} else {
linkTag = `<link rel="canonical" href="${(toText = to = targetUrl)}">\n`
}
return `<!DOCTYPE html>
<meta charset="utf-8">
${canonicalLink}<script>location="${relativeUrl}"</script>
<meta http-equiv="refresh" content="0; url=${relativeUrl}">
${linkTag || ''}<script>location="${to}"</script>
<meta http-equiv="refresh" content="0; url=${to}">
<meta name="robots" content="noindex">
<title>Redirect Notice</title>
<h1>Redirect Notice</h1>
<p>The page you requested has been relocated to <a href="${relativeUrl}">${canonicalUrl || relativeUrl}</a>.</p>`
<p>The page you requested has been relocated to <a href="${to}">${toText}</a>.</p>`
}

@@ -156,7 +163,4 @@

function computeRelativeUrlPath (from, to) {
return from === to
? to.charAt(to.length - 1) === '/'
? './'
: path.basename(to)
: (path.relative(path.dirname(from + '.'), to) || '.') + (to.charAt(to.length - 1) === '/' ? '/' : '')
if (to === from) return to.charAt(to.length - 1) === '/' ? './' : path.basename(to)
return (path.relative(path.dirname(from + '.'), to) || '.') + (to.charAt(to.length - 1) === '/' ? '/' : '')
}

@@ -163,0 +167,0 @@

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

@@ -5,0 +5,0 @@ "license": "MPL-2.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