mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-19 21:21:39 +02:00
Add undocumented published setting to front matter
A new "published" setting that is the opposite of "draft" is added and left intentionally undocumented. This setting comes from jekyll and eases the transition to hugo greatly. We leave it undocumented so that folks don't rely on it, but also don't shoot themselves in the foot during a jekyll migration. The foot-shooting occurs if they have only a few documents that were drafts ("published: false") in the jekyll version of their site and don't notice that they were published in the migration to hugo.
This commit is contained in:
committed by
Bjørn Erik Pedersen
parent
5b90b388cb
commit
311593bff0
@@ -854,6 +854,21 @@ func TestPagePaths(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
var PAGE_WITH_DRAFT_AND_PUBLISHED = `---
|
||||
title: broken
|
||||
published: false
|
||||
draft: true
|
||||
---
|
||||
some content
|
||||
`
|
||||
|
||||
func TestDraftAndPublishedFrontMatterError(t *testing.T) {
|
||||
_, err := NewPageFrom(strings.NewReader(PAGE_WITH_DRAFT_AND_PUBLISHED), "content/post/broken.md")
|
||||
if err != ErrHasDraftAndPublished {
|
||||
t.Errorf("expected ErrHasDraftAndPublished, was %#v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func listEqual(left, right []string) bool {
|
||||
if len(left) != len(right) {
|
||||
return false
|
||||
|
Reference in New Issue
Block a user