Update hugo.toml baseURL and modify projectSetup.js and themeSetup.js scripts to toggle baseURL value
This commit is contained in:
parent
8fde71d68e
commit
e651f2eb6a
@ -1,6 +1,6 @@
|
|||||||
######################## default configuration ####################
|
######################## default configuration ####################
|
||||||
# The base URL of your site (required). This will be prepended to all relative URLs.
|
# The base URL of your site (required). This will be prepended to all relative URLs.
|
||||||
baseURL = "/"
|
baseURL = "https://example.org"
|
||||||
# Title of your website (required).
|
# Title of your website (required).
|
||||||
title = "Hugoplate"
|
title = "Hugoplate"
|
||||||
# Your theme name
|
# Your theme name
|
||||||
|
@ -5,6 +5,13 @@ const toggleComment = ({ filepath, regex }) => {
|
|||||||
let updatedContent = fs.readFileSync(filepath, "utf8");
|
let updatedContent = fs.readFileSync(filepath, "utf8");
|
||||||
const match = updatedContent.match(regex);
|
const match = updatedContent.match(regex);
|
||||||
|
|
||||||
|
if (filepath.endsWith("hugo.toml")) {
|
||||||
|
updatedContent = updatedContent.replace(
|
||||||
|
'baseURL = "https://example.org"',
|
||||||
|
'baseURL = "/"',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (match) {
|
if (match) {
|
||||||
const matchedContent = match[0];
|
const matchedContent = match[0];
|
||||||
const hasComment = matchedContent.startsWith("# ");
|
const hasComment = matchedContent.startsWith("# ");
|
||||||
@ -110,6 +117,8 @@ const setupProject = () => {
|
|||||||
const exampleSite = path.join(rootFolder, "exampleSite");
|
const exampleSite = path.join(rootFolder, "exampleSite");
|
||||||
iterateFilesAndFolders(exampleSite, { destinationRoot: rootFolder });
|
iterateFilesAndFolders(exampleSite, { destinationRoot: rootFolder });
|
||||||
deleteFolder(exampleSite);
|
deleteFolder(exampleSite);
|
||||||
|
} else {
|
||||||
|
console.log("Project already setup");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -5,6 +5,13 @@ const toggleComment = ({ filepath, regex }) => {
|
|||||||
let updatedContent = fs.readFileSync(filepath, "utf8");
|
let updatedContent = fs.readFileSync(filepath, "utf8");
|
||||||
const match = updatedContent.match(regex);
|
const match = updatedContent.match(regex);
|
||||||
|
|
||||||
|
if (filepath.endsWith("hugo.toml")) {
|
||||||
|
updatedContent = updatedContent.replace(
|
||||||
|
'baseURL = "/"',
|
||||||
|
'baseURL = "https://example.org"',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (match) {
|
if (match) {
|
||||||
const matchedContent = match[0];
|
const matchedContent = match[0];
|
||||||
const hasComment = matchedContent.startsWith("# ");
|
const hasComment = matchedContent.startsWith("# ");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user