<%* const folderName = await tp.system.prompt(“Enter slug name:”); if (!folderName) { new Notice(“Folder creation canceled.”); return; }

// Function to URLerize the folder name const urlerize = (name) => { return name .toLowerCase() // Convert to lowercase .replace(/[^a-z0-9\s-]/g, “”) // Remove special characters .trim() // Trim whitespace .replace(/\s+/g, “-”); // Replace spaces with hyphens };

// URLerize the folder name const sanitizedFolderName = urlerize(folderName);

// Define the base path for folders const basePath = “blog”; const imagesPath = “images”; const newFolderPath = ${basePath}/${sanitizedFolderName}; const imagesFolderPath = ${basePath}/${sanitizedFolderName}/${imagesPath};

// Create the folders await app.vault.createFolder(newFolderPath); await app.vault.createFolder(imagesFolderPath);

// move the default untitled file await tp.file.move(newFolderPath + ‘/index’);

// Define YAML front matter %>— title: <% tp.file.title %> date: <% tp.date.now(“YYYY-MM-DDTHH:mm:ssZ”) %> slug: <% sanitizedFolderName %> draft: true images:

  • “images/default.webp” tags:
  • “default” categories:
  • “default” author: “Sudhir S”

author: [“Me”, “You”] # multiple authors

weight: 1

aliases: ["/first"]

showToc: true TocOpen: false hidemeta: false comments: false description: “A default description.” summary: “A default summary for the post.”

canonicalURL: “https://canonical.url/to/page"

disableShare: false disableHLJS: false hideSummary: false searchHidden: false ShowReadingTime: true ShowBreadCrumbs: false ShowPostNavLinks: true ShowWordCount: false ShowRssButtonInSectionTermList: true UseHugoToc: true cover: image: “images/default.webp” # image path/url alt: “default image” # alt text caption: “default cover image” # display caption under cover relative: true # when using page bundles set this to true hidden: false # only hide on current single page

editPost:

# URL: "https://github.com/<path_to_repo>/content"
# Text: "Suggest Changes" # edit text
# appendFilePath: true # to append file path to Edit link

You got this!