Frontmatter permalink + plaintext not working for txt file outputs
- Maizzle Version: 4.8.2
- Node.js Version: 9.5.1 (Node v18.16.0)
Problem
Using plaintext in a template's frontmatter where you've also specified a different destination filename via permalink doesn't produce a renamed txt file. It only applies the permalink configuration to the html output.
Steps
- Configure
plaintextin your maizzle config to produce html and plaintext templates:
/** @type {import('@maizzle/framework').Config} */
module.exports = {
build: {
posthtml: {
options: {
decodeEntities: true,
replaceQuote: false,
},
},
browsersync: {},
templates: {
source: "src/templates",
plaintext: {
skipHtmlDecoding: true,
destination: {
path: "build_local",
extension: "txt",
},
},
destination: {
path: "build_local",
},
omit: ["src/**/.archive/*"],
assets: [
{
destination: "images",
source: "src/images",
},
],
},
},
};
- Add empty production config
/*
|-------------------------------------------------------------------------------
| Production config https://maizzle.com/docs/environments
|-------------------------------------------------------------------------------
|
| This is where you define settings that optimize your emails for production.
| These will be merged on top of the base config.js, so you only need to
| specify the options that are changing.
|
*/
// since the base config is merged in with this during production builds
// *and* our base config uses env vars for configuring, we don't need overrides for production
module.exports = {};
- Create a
testing.htmltemplate and configurepermalinkandplaintextin its frontmatter:
---
permalink: permalink_testing_build/permalink-override.html
plaintext: true
---
<x-main>
<h1>Permalink + Plaintext Reproduction</h1>
<p>This template ends up in permalink_testing_build/permalink-override.html</p>
<p>its plaintext version ends up living in build_local/testing.txt, though</p>
</x-main>
-
Run a production build
maizzle build production -
Observe
permalink-override.htmlat the provided permalink path and atesting.txtfile in the originalbuild_localdirectory
Day late, but here's the repro I put together: https://github.com/joeyfigaro/maizzle-permalink-repro
Build results for .txt and .html outputs
Thanks for the detailed report Joey, looks like a bug indeed. Will look into it and fix it 👍
This will be fixed in 5.0.0, unfortunately I don't have enough time to also fix it in v4.x sorry!