@antora/site-mapper
Advanced tools
Comparing version 1.0.0-rc.1 to 1.0.0-rc.2
'use strict' | ||
const File = require('vinyl') | ||
const versionCompareDesc = require('@antora/content-classifier/lib/util/version-compare-desc') | ||
const versionCompare = require('@antora/content-classifier/lib/util/version-compare-desc') | ||
@@ -14,4 +14,4 @@ const XML_DECL = '<?xml version="1.0" encoding="UTF-8"?>' | ||
* | ||
* Iterates over the files from the page family in the content catalog and | ||
* creates sitemap files. If there's only one component, all the entries are | ||
* Iterates over the specified pages and creates sitemap files that list the | ||
* URLs for these pages. If there's only one component, all the entries are | ||
* added to a sitemap.xml file that gets published to the root of the site. If | ||
@@ -35,11 +35,9 @@ * there's more than one component, the sitemaps are partitioned into separate | ||
* @param {String} playbook.site.url - The base URL of the site. | ||
* @param {ContentCatalog} contentCatalog - The content catalog that provides | ||
* access to the virtual content files (i.e., pages) in the site. | ||
* @param {Array<File>} pages - The publishable pages to to map. | ||
* @returns {Array<File>} An array of File objects that represent the sitemaps. | ||
*/ | ||
function mapSite (playbook, contentCatalog) { | ||
function mapSite (playbook, pages) { | ||
let siteUrl = playbook.site.url | ||
if (!siteUrl) return [] | ||
if (siteUrl.charAt(siteUrl.length - 1) === '/') siteUrl = siteUrl.substr(0, siteUrl.length - 1) | ||
const pages = contentCatalog.findBy({ family: 'page' }) | ||
if (!pages.length) return [] | ||
@@ -66,3 +64,3 @@ const lastmodISO = new Date().toISOString() | ||
sitemapEntries.sort((a, b) => a.url.localeCompare(b.url)) | ||
if (sitemap.versions.size > 1) sitemapEntries.sort((a, b) => versionCompareDesc(a.version, b.version)) | ||
if (sitemap.versions.size > 1) sitemapEntries.sort((a, b) => versionCompare(a.version, b.version)) | ||
delete sitemap.versions | ||
@@ -69,0 +67,0 @@ sitemapEntries = sitemapEntries.map(createUrlElement.bind(null, siteUrl)) |
{ | ||
"name": "@antora/site-mapper", | ||
"version": "1.0.0-rc.1", | ||
"version": "1.0.0-rc.2", | ||
"description": "Generates sitemap files that list all publishable pages in an Antora documentation pipeline.", | ||
@@ -18,3 +18,3 @@ "license": "MPL-2.0", | ||
"dependencies": { | ||
"@antora/content-classifier": "1.0.0-rc.1", | ||
"@antora/content-classifier": "1.0.0-rc.2", | ||
"vinyl": "^2.1.0" | ||
@@ -21,0 +21,0 @@ }, |
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
6626
129
+ Added@antora/content-classifier@1.0.0-rc.2(transitive)
- Removed@antora/content-classifier@1.0.0-rc.1(transitive)
- Removedsemver-compare@1.0.0(transitive)