-
-
Notifications
You must be signed in to change notification settings - Fork 103
Description
Describe the bug
When creating a new content based on a content type with a template as from Issue #351 any frontmatter formatting in the template file is wiped out. Comments are removed, whitespace is removed. Keys which exist in the template but not in the content type are preserved and any non-frontmatter content (below the frontmatter) is preserved.
To Reproduce
Steps to reproduce the behavior:
- Make a file like:
/archetypes/blog/index.md/
---
# Predefined Parameters (eg: .Title)
title: {{ replace (replaceRE `^\d*(-| |)` "" .Name) "-" " " | title }}
slug: {{ replaceRE `^\d*(-| |)` "" .Name | urlize }}
draft: true
date: {{ .Date }}
lastmod: {{ .Date }}
description: &summary
summary: *summary
keywords:
type: blog
weight: 10
randokey: nothin
# User-Defined Parameters (eg: .Params.categories)
subtitle:
featuredPost: false
headerImage:
src: images/headerdefault.png
title:
alt:
categories:
tags:
---
This is a test.- Add it to the content type:
"name": "blog",
"pageBundle": true,
"template": "[[workspace]]/archetypes/blog/index.md",- Create a new content of type blog
- See what it hath wrought:
---
title: test1
slug: ""
draft: ""
date: 2022-08-09T23:43:44.433Z
lastmod: 2022-08-09T23:43:44.433Z
description: "&summary"
summary: "*summary"
keywords: ""
type: blog
weight: 10
randokey: nothin
subtitle: ""
featuredPost: false
headerImage:
src: images/headerdefault.png
title: test1
alt: ""
categories: ""
tags: ""
---
This is a test.Expected behavior
Formatting to remain, only the keys defined in the content type would have their values specifically changed.
Desktop (please complete the following information):
- OS: Windows 10
- VSCode 1.7.0
- Front Matter 8.0.1
Additional context
Also, in Hugo at least, one can define an archetype for a page bundle, with folders and extra files and all. They will all get created when the new content of that archetype is created. It would be nice to have the same behavior with content types linked to templates.