cloudcannon-hugo
Advanced tools
Comparing version 1.0.8 to 1.0.9
{ | ||
"name": "cloudcannon-hugo", | ||
"type": "module", | ||
"version": "1.0.8", | ||
"version": "1.0.9", | ||
"description": "Generates the files necessary for a hugo site to integrate with CloudCannon CMS", | ||
@@ -6,0 +6,0 @@ "main": "src/index.js", |
@@ -116,3 +116,3 @@ import chalk from 'chalk'; | ||
const legacy = getLegacyConfig(hugoConfig); | ||
const baseUrl = file.base_url || getUrlPathname(hugoConfig.baseURL) || ''; | ||
const baseURL = file.base_url || getUrlPathname(hugoConfig.baseURL) || ''; | ||
@@ -122,3 +122,3 @@ const config = { | ||
...file, | ||
base_url: baseUrl === '/' ? '' : baseUrl, | ||
base_url: baseURL === '/' ? '' : baseURL, | ||
source: file.source || paths.source || '', | ||
@@ -125,0 +125,0 @@ multilingual: { |
import Papa from 'papaparse'; | ||
import { runProcess } from '../helpers/helpers.js'; | ||
import { runProcess, getUrlPathname } from '../helpers/helpers.js'; | ||
import pathHelper from '../helpers/paths.js'; | ||
@@ -29,3 +29,14 @@ import chalk from 'chalk'; | ||
return fileList.data.reduce((memo, file) => { | ||
memo[file.path] = ('/' + file.permalink.replace(hugoConfig.baseURL ?? '', '')).replace(/^\/\//, '/'); | ||
const baseURLPathname = getUrlPathname(hugoConfig.baseURL || '') | ||
.replace(/^\/*/g, '') | ||
.replace(/\/*$/g, '/'); | ||
let filePathname = getUrlPathname(file.permalink).replace(/^\/*/g, ''); | ||
if (filePathname.startsWith(baseURLPathname)) { | ||
filePathname = filePathname.substring(baseURLPathname.length); | ||
} | ||
const url = ('/' + filePathname).replace(/^\/\//, '/'); | ||
memo[file.path] = url; | ||
return memo; | ||
@@ -32,0 +43,0 @@ }, {}); |
@@ -119,3 +119,3 @@ import { join, extname, basename } from 'path'; | ||
const configObject = await generateConfigObject(flags); | ||
configObject.baseURL = flags.baseUrl || configObject.baseURL || '/'; | ||
configObject.baseURL = flags.baseURL || configObject.baseURL || '/'; | ||
@@ -122,0 +122,0 @@ if (flags.source) { |
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
42331
1085