From 3ab13b59a30618964f5f94fc89df330339f3be0e Mon Sep 17 00:00:00 2001 From: vjeantet Date: Wed, 9 Sep 2020 00:48:16 +0200 Subject: refactor hide option in frontmatter --- exampleSite/content/404.md | 5 +--- .../00-adding-content/_index.md | 10 +++----- .../00-adding-content/page-slide/_index.md | 7 ------ .../01-homepage/_index.md | 2 +- .../02-navigation-search/_index.md | 2 +- .../02-navigation-search/menu/_index.md | 2 +- .../02-navigation-search/thefooter/_index.md | 2 +- .../02-navigation-search/theheader/_index.md | 2 +- .../02-navigation-search/toc/_index.md | 2 +- .../03-look-and-feel/_index.md | 2 +- .../content/content-and-customization/_index.md | 2 +- .../content/docport-theme/credits/_index.md | 2 +- exampleSite/content/examples/_index.md | 2 +- .../content/examples/page without any/_index.md | 14 ++++------- .../content/examples/page without footer/_index.md | 4 ++-- .../content/examples/page without header/_index.md | 4 ++-- .../examples/page without next page/_index.md | 4 ++-- .../page without sidebar and toc/_index.md | 6 ++--- .../content/examples/page without toc/_index.md | 4 ++-- exampleSite/content/getting-start/_index.md | 3 ++- exampleSite/content/shortcodes/_index.md | 2 +- exampleSite/static/admin/config.yml | 4 ++-- layouts/_default/baseof.html | 28 ++++++++++++---------- layouts/partials/body-article-content.html | 6 ++--- layouts/partials/body-header.html | 2 +- 25 files changed, 52 insertions(+), 71 deletions(-) diff --git a/exampleSite/content/404.md b/exampleSite/content/404.md index 65d2509..e7fcdff 100644 --- a/exampleSite/content/404.md +++ b/exampleSite/content/404.md @@ -1,14 +1,11 @@ --- -hide_breadcrumb: true -hide_nav: true title: Whoops! Page not found description: This is a 404 page date: 2020-09-08T20:40:23.389Z layout: page hidden: true -hide_toc: true +hide: toc, nav, breadcrumb, nextpage url: 404.html -hide_nextpage: true --- That page can't be found. diff --git a/exampleSite/content/content-and-customization/00-adding-content/_index.md b/exampleSite/content/content-and-customization/00-adding-content/_index.md index a844eca..9dc895a 100644 --- a/exampleSite/content/content-and-customization/00-adding-content/_index.md +++ b/exampleSite/content/content-and-customization/00-adding-content/_index.md @@ -12,6 +12,7 @@ pre: "" lastmodifieremail: valere.jeantet@gmail.com creatoremail: valere.jeantet@gmail.com weight: 1 + tags: - tag1 - tag2 @@ -71,13 +72,8 @@ On top of the [existing ones](https://gohugo.io/content-management/front-matter/ # order sections weight=10 - # Hide some theme components - hide_header=false # set true to hide site header - hide_nav=false # set true to hide the left navigation menu - hide_breadcrumb=false # set true to hide the breadcrumb - hide_toc=false # set true to hide the right menu (table of contents) - hide_footer=false #set true to hide the website footer - hide_nextpage=false #set true to hide the "next page" chevron + # Hide some page components + hide: header, nav, breadcrumb, toc, footer, nextpage # subpage subpage = false # usefull when you want to force a sub section to be considered as a subpage diff --git a/exampleSite/content/content-and-customization/00-adding-content/page-slide/_index.md b/exampleSite/content/content-and-customization/00-adding-content/page-slide/_index.md index 957118c..9924552 100644 --- a/exampleSite/content/content-and-customization/00-adding-content/page-slide/_index.md +++ b/exampleSite/content/content-and-customization/00-adding-content/page-slide/_index.md @@ -4,13 +4,6 @@ description = "" date = "2017-04-24T18:36:24+02:00" weight = 90 - -hide_header=false -hide_nav=false -hide_breadcrumb=false -hide_toc=false -hide_footer=false - +++ A basic .md file can be rendered as a reveal.js presentation full screen. diff --git a/exampleSite/content/content-and-customization/01-homepage/_index.md b/exampleSite/content/content-and-customization/01-homepage/_index.md index b3b6a4b..6cd1951 100644 --- a/exampleSite/content/content-and-customization/01-homepage/_index.md +++ b/exampleSite/content/content-and-customization/01-homepage/_index.md @@ -18,7 +18,7 @@ Create a `_index.md` in `content` root folder. ## Landing page appearance Remove navigation components from your landing page by setting options in its page frontmatter. You will be able to hide header, breadcrum, toc or footer... -* see hide_xxxx options [here]({{%relref "00-adding-content#page-frontmatter"%}}) +* see `hide` options [here]({{%relref "00-adding-content#page-frontmatter"%}}) * see [examples of pages]({{%relref "/examples"%}}) rendered with theses options {{%notice success%}} diff --git a/exampleSite/content/content-and-customization/02-navigation-search/_index.md b/exampleSite/content/content-and-customization/02-navigation-search/_index.md index 24aed7c..2274dd5 100644 --- a/exampleSite/content/content-and-customization/02-navigation-search/_index.md +++ b/exampleSite/content/content-and-customization/02-navigation-search/_index.md @@ -2,7 +2,7 @@ title = "Navigation & Search" description = "" weight = 30 -hide_toc = true +hide = "toc" +++ Docport allow you to easily customize header, left & righ sidebars and footer. diff --git a/exampleSite/content/content-and-customization/02-navigation-search/menu/_index.md b/exampleSite/content/content-and-customization/02-navigation-search/menu/_index.md index cc2eda9..4a38d9a 100644 --- a/exampleSite/content/content-and-customization/02-navigation-search/menu/_index.md +++ b/exampleSite/content/content-and-customization/02-navigation-search/menu/_index.md @@ -81,5 +81,5 @@ Create a `_index.md` page in `_layout/_sidepage-after` folder. ## Hide site menu -Set `hide_nav=true` in your page's frontmatter, see [an example here]({{%relref "examples/page without sidebar and toc"%}}) +Set `hide: nav` in your page's frontmatter, see [an example here]({{%relref "examples/page without sidebar and toc"%}}) diff --git a/exampleSite/content/content-and-customization/02-navigation-search/thefooter/_index.md b/exampleSite/content/content-and-customization/02-navigation-search/thefooter/_index.md index 399c203..b4bca90 100644 --- a/exampleSite/content/content-and-customization/02-navigation-search/thefooter/_index.md +++ b/exampleSite/content/content-and-customization/02-navigation-search/thefooter/_index.md @@ -27,5 +27,5 @@ This allow you to define a localized footer content. {{%alert info%}}**Tip :** You can put a full HTML content in your `_index.md` file{{%/alert%}} ## Hide site footer -Set `hide_footer=true` in your page's frontmatter, see [an example here]({{%relref "examples/page without footer"%}}) +Set `hide: footer` in your page's frontmatter, see [an example here]({{%relref "examples/page without footer"%}}) diff --git a/exampleSite/content/content-and-customization/02-navigation-search/theheader/_index.md b/exampleSite/content/content-and-customization/02-navigation-search/theheader/_index.md index e13929f..0ab6123 100644 --- a/exampleSite/content/content-and-customization/02-navigation-search/theheader/_index.md +++ b/exampleSite/content/content-and-customization/02-navigation-search/theheader/_index.md @@ -58,4 +58,4 @@ Its content is what you get in the header (site shortscurs remains) This allow you to define a localized header content. ## Hide site header -Set `hide_header=true` in your page's frontmatter, see [an example here]({{%relref "examples/page without header"%}}) \ No newline at end of file +Set `hide: header` in your page's frontmatter, see [an example here]({{%relref "examples/page without header"%}}) \ No newline at end of file diff --git a/exampleSite/content/content-and-customization/02-navigation-search/toc/_index.md b/exampleSite/content/content-and-customization/02-navigation-search/toc/_index.md index 9f479b9..d87edd0 100644 --- a/exampleSite/content/content-and-customization/02-navigation-search/toc/_index.md +++ b/exampleSite/content/content-and-customization/02-navigation-search/toc/_index.md @@ -44,4 +44,4 @@ Create a `_index.md` page in `_layout/_sidepage-after` folder. ## Hide right sidebar -Set `hide_toc=true` in your page's frontmatter, see [an example here]({{%relref "examples/page without toc"%}}) +Set `hide: toc` in your page's frontmatter, see [an example here]({{%relref "examples/page without toc"%}}) diff --git a/exampleSite/content/content-and-customization/03-look-and-feel/_index.md b/exampleSite/content/content-and-customization/03-look-and-feel/_index.md index 761b4a2..f24e021 100644 --- a/exampleSite/content/content-and-customization/03-look-and-feel/_index.md +++ b/exampleSite/content/content-and-customization/03-look-and-feel/_index.md @@ -1,7 +1,7 @@ +++ title = "Look and feel" Weight=40 -hide_toc=true +hide = "toc" +++ You can change the style and behavior of the theme without touching its source code. diff --git a/exampleSite/content/content-and-customization/_index.md b/exampleSite/content/content-and-customization/_index.md index 968f604..60a49f8 100644 --- a/exampleSite/content/content-and-customization/_index.md +++ b/exampleSite/content/content-and-customization/_index.md @@ -2,7 +2,7 @@ title = "Content and Customization" description = "" weight = 30 -hide_toc = true +hide = "toc" +++ {{%children style="h2" description="true" %}} diff --git a/exampleSite/content/docport-theme/credits/_index.md b/exampleSite/content/docport-theme/credits/_index.md index 0a2a574..e2df920 100644 --- a/exampleSite/content/docport-theme/credits/_index.md +++ b/exampleSite/content/docport-theme/credits/_index.md @@ -2,7 +2,7 @@ title = "Credits" description = "Contributors and packages used by hugo-theme-docport" subpage = true -hide_toc=true +hide = "toc" +++ diff --git a/exampleSite/content/examples/_index.md b/exampleSite/content/examples/_index.md index 12c7ced..fe78245 100644 --- a/exampleSite/content/examples/_index.md +++ b/exampleSite/content/examples/_index.md @@ -1,7 +1,7 @@ --- title: Examples weight: 50 -hide_toc: true +hide: toc --- some examples diff --git a/exampleSite/content/examples/page without any/_index.md b/exampleSite/content/examples/page without any/_index.md index 87b7cc4..6546d6b 100644 --- a/exampleSite/content/examples/page without any/_index.md +++ b/exampleSite/content/examples/page without any/_index.md @@ -3,13 +3,10 @@ title: A page with only TOC and next page description: hide everything weight: 90 -hide_nextpage: false -hide_toc: false -hide_header: true -hide_nav: true -hide_breadcrumb: true -hide_footer: true +hide: header, nav, breadcrumb, footer + + --- Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, @@ -22,10 +19,7 @@ proident, sunt in culpa qui officia deserunt mollit anim id est laborum. ```yaml --- title: A page with only TOC and next page -hide_header: true -hide_nav: true -hide_breadcrumb: true -hide_footer: true +hide: header, nav, breadcrumb, footer --- ``` diff --git a/exampleSite/content/examples/page without footer/_index.md b/exampleSite/content/examples/page without footer/_index.md index b9365d3..b224304 100644 --- a/exampleSite/content/examples/page without footer/_index.md +++ b/exampleSite/content/examples/page without footer/_index.md @@ -1,7 +1,7 @@ --- title: A page without footer weight: 20 -hide_footer: true +hide: footer --- @@ -9,7 +9,7 @@ hide_footer: true ```yaml --- title: A page without footer -hide_footer: true +hide: footer --- ``` {{%/panel%}} diff --git a/exampleSite/content/examples/page without header/_index.md b/exampleSite/content/examples/page without header/_index.md index 9b55a2a..eb124d9 100644 --- a/exampleSite/content/examples/page without header/_index.md +++ b/exampleSite/content/examples/page without header/_index.md @@ -1,14 +1,14 @@ --- title: A page without header weight: 10 -hide_header: true +hide: header --- {{%panel header="page's frontmatter"%}} ```yaml --- title: A page without header -hide_header: true +hide: header --- ``` {{%/panel%}} diff --git a/exampleSite/content/examples/page without next page/_index.md b/exampleSite/content/examples/page without next page/_index.md index d5d080f..165b946 100644 --- a/exampleSite/content/examples/page without next page/_index.md +++ b/exampleSite/content/examples/page without next page/_index.md @@ -2,7 +2,7 @@ title: A page without "NEXT PAGE" description: hide everything weight: 80 -hide_nextpage: true +hide: nextpage --- Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, @@ -15,7 +15,7 @@ proident, sunt in culpa qui officia deserunt mollit anim id est laborum. ```yaml --- title: A page without "NEXT PAGE" -hide_nextpage: true +hide: nextpage --- ``` {{%/panel%}} diff --git a/exampleSite/content/examples/page without sidebar and toc/_index.md b/exampleSite/content/examples/page without sidebar and toc/_index.md index 8d8ca30..cd8fe8c 100644 --- a/exampleSite/content/examples/page without sidebar and toc/_index.md +++ b/exampleSite/content/examples/page without sidebar and toc/_index.md @@ -1,16 +1,14 @@ --- title: A page without sidebar and toc weight: 20 -hide_toc: true -hide_nav: true +hide: toc, nav --- {{%panel header="page's frontmatter"%}} ```yaml --- title: A page without sidebar and toc -hide_toc: true -hide_nav: true +hide: toc, nav --- ``` diff --git a/exampleSite/content/examples/page without toc/_index.md b/exampleSite/content/examples/page without toc/_index.md index ede7f35..3483ac1 100644 --- a/exampleSite/content/examples/page without toc/_index.md +++ b/exampleSite/content/examples/page without toc/_index.md @@ -1,14 +1,14 @@ --- title: A page without table of contents weight: 20 -hide_toc: true +hide: toc --- {{%panel header="page's frontmatter"%}} ```yaml --- title: A page without table of contents -hide_toc: true +hide: toc --- ``` diff --git a/exampleSite/content/getting-start/_index.md b/exampleSite/content/getting-start/_index.md index 7653baa..a48db43 100644 --- a/exampleSite/content/getting-start/_index.md +++ b/exampleSite/content/getting-start/_index.md @@ -6,7 +6,8 @@ date: 2020-08-20T16:42:11.812Z weight: 2 head:
alwaysopen: true -hide_toc : true +hide: + - toc --- ## Requirements diff --git a/exampleSite/content/shortcodes/_index.md b/exampleSite/content/shortcodes/_index.md index 7a1881d..8d82c46 100644 --- a/exampleSite/content/shortcodes/_index.md +++ b/exampleSite/content/shortcodes/_index.md @@ -3,7 +3,7 @@ title = "Shortcodes" description = "" date = "2017-04-24T18:36:24+02:00" weight = 30 -hide_toc = true +hide = ["toc"] +++ A bunch of Shortcodes are available with this theme : diff --git a/exampleSite/static/admin/config.yml b/exampleSite/static/admin/config.yml index 2a07d5e..4719e46 100644 --- a/exampleSite/static/admin/config.yml +++ b/exampleSite/static/admin/config.yml @@ -29,8 +29,8 @@ collections: - { label: 'Publish Date', name: 'date', widget: 'datetime' } - { label: 'Order', name: 'weight', widget: 'number', default: 10,required: false } - { label: 'Body', name: 'body', widget: 'markdown' } - - { label: 'Display As', name: 'layout', widget: 'select',required: false, hint: 'Choose how to layout your content', options: [{ label: "Default (empty value)", value: "" },{ label: "Simple - hide right bar and breadcrumb ", value: "simple" }, { label: "Full - hide left nav, right nav and breadcrumb", value: "full" }, { label: "Raw - only the content will be displayed (usefull for homepage)", value: "raw" }]} - - { label: 'Is Subpage ?', name: 'subpage', widget: 'boolean',required: false, default: false, hint: 'Display this page as subcontent' } + - { label: 'Hide page components', name: 'hide', widget: 'select',required: false, multiple: true, hint: 'Choose how to layout your content', options: [{ label: "Header", value: "header" },{ label: "Left menu ", value: "nav" }, { label: "breadcrumb", value: "breadcrumb" }, { label: "right bar with table of content", value: "breadcrumb" }, { label: "Next Page Helper", value: "nextpage" }, { label: "footer", value: "footer" }]} + - { label: 'Force display as a subpage ?', name: 'subpage', widget: 'boolean',required: false, default: false, hint: 'Display this page as subcontent' } - { label: 'Is Hidden ?', name: 'hidden', widget: 'boolean',required: false, default: false, hint: 'Hide this page from any menu' } - { label: 'Menu Entry Head', name: 'head', widget: 'string', required: false, hint: 'Display something before menu entry' } - { label: 'Menu label Prefix', name: 'pre', widget: 'string', required: false, hint: 'Display something before menu label' } diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 5e437fd..ede8f29 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -20,14 +20,14 @@ class=" {{- with .Params.render}}render_{{.}} {{end -}} - {{if .Params.hide_header}}hideheader {{end -}} - {{if .Params.hide_nav}}hidenav {{end -}} - {{if .Params.hide_breadcrumb}}hidebreadcrumb {{end -}} - {{if .Params.hide_toc}}hidetoc {{end -}} - {{if .Params.hide_footer}}hidefooter {{end -}} - {{if .Params.hide_nextpage}}hidenextpage {{end -}} + {{if (in .Params.hide "header")}}hideheader {{end -}} + {{if (in .Params.hide "nav")}}hidenav {{end -}} + {{if (in .Params.hide "breadcrumb")}}hidebreadcrumb {{end -}} + {{if (in .Params.hide "toc")}}hidetoc {{end -}} + {{if (in .Params.hide "footer")}}hidefooter {{end -}} + {{if (in .Params.hide "nextpage")}}hidenextpage {{end -}} "> - + --> {{ if ne $redirectURL ""}}