Skip to content

Commit

Permalink
fix(preset-hugo): update content fallback values
Browse files Browse the repository at this point in the history
  • Loading branch information
paulrobertlloyd committed Jan 10, 2021
1 parent 901ad93 commit 1794e34
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/preset-hugo/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ export const HugoPreset = class {
postTemplate(properties) {
let content;
if (properties.content) {
content = properties.content.text || properties.content.html;
content = properties.content.text || properties.content.html || properties.content;
content = `${content}\n`;
} else {
content = '';
Expand Down
15 changes: 15 additions & 0 deletions packages/preset-hugo/tests/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,21 @@ title: Lunchtime
`);
});

test('Renders post template with basic content', t => {
const hugo = new HugoPreset();
const result = hugo.postTemplate({
published: '2020-02-02',
name: 'Lunchtime',
content: 'I ate a *cheese* sandwich, which was nice.'
});
t.is(result, `---
date: 2020-02-02
title: Lunchtime
---
I ate a *cheese* sandwich, which was nice.
`);
});

test('Renders post template with HTML content', t => {
const hugo = new HugoPreset();
const result = hugo.postTemplate({
Expand Down

0 comments on commit 1794e34

Please sign in to comment.