diff --git a/exampleSite/config/_default/params.toml b/exampleSite/config/_default/params.toml index 58e14fd163..72f406018c 100644 --- a/exampleSite/config/_default/params.toml +++ b/exampleSite/config/_default/params.toml @@ -135,6 +135,12 @@ disableToc = false # shown in the topbar. disableBreadcrumb = false +# Hide the print button. +# Default: false +# This hides the print button if you activated the print output format. +# This can be overridden in the page's frontmatter. +disablePrintButton = false + # Hide Next and Previous navigation buttons. # Default: false # If the navigation buttons are hidden, also the keyboard shortcuts are diff --git a/exampleSite/content/authoring/frontmatter/reference/frontmatter.toml b/exampleSite/content/authoring/frontmatter/reference/frontmatter.toml index c66a474cbd..ed056b78ec 100644 --- a/exampleSite/content/authoring/frontmatter/reference/frontmatter.toml +++ b/exampleSite/content/authoring/frontmatter/reference/frontmatter.toml @@ -52,6 +52,12 @@ disableToc = false # shown in the topbar. disableBreadcrumb = false +# Hide the print button. +# Default: false +# This hides the print button if you activated the print output format. +# If not set, the set value of your site's hugo.toml is used. +disablePrintButton = false + # Hide Next and Previous navigation buttons. # Default: false # If the navigation buttons are hidden, also the keyboard shortcuts are diff --git a/exampleSite/content/authoring/frontmatter/topbar/_index.en.md b/exampleSite/content/authoring/frontmatter/topbar/_index.en.md index 3830bc043a..2cee6ead55 100644 --- a/exampleSite/content/authoring/frontmatter/topbar/_index.en.md +++ b/exampleSite/content/authoring/frontmatter/topbar/_index.en.md @@ -1,8 +1,8 @@ +++ categories = ["howto"] description = "Configure the topbar" -frontmatter = ["disableBreadcrumb", "disableNextPrev", "disableToc", "editURL"] -options = ["disableBreadcrumb", "disableNextPrev", "disableToc", "editURL"] +frontmatter = ["disableBreadcrumb", "disableNextPrev", "disablePrintButton", "disableToc", "editURL"] +options = ["disableBreadcrumb", "disableNextPrev", "disablePrintButton", "disableToc", "editURL"] title = "Topbar" weight = 4 +++ @@ -15,7 +15,7 @@ Your topbar contains the following elements. Some of them are configuarable: - {{% button style="transparent" icon="list-alt" %}}{{% /button %}} **toc**: [opens the table of contents in an overlay](#table-of-contents) - {{% button style="transparent" icon="empty" %}}{{% /button %}} **breadcrumb**: shows the clickable [breadcrumbs](#breadcrumbs) - {{% button style="transparent" icon="pen" %}}{{% /button %}} **edit**: browses to the editable page if the `editURL` [parameter is set](#edit-button) -- {{% button style="transparent" icon="print" %}}{{% /button %}} **print**: browses to the chapters printable page if [print support](configuration/sitemanagement/outputformats#print-support) was activated +- {{% button style="transparent" icon="print" %}}{{% /button %}} **print**: browses to the [chapters printable page}(#print-button) if [print support](configuration/sitemanagement/outputformats#print-support) was activated - {{% button style="transparent" icon="chevron-left" %}}{{% /button %}} **prev**: browses to the [previous page](#arrow-navigation) if there is one - {{% button style="transparent" icon="chevron-right" %}}{{% /button %}} **next**: browses to the [next page](#arrow-navigation) if there is one - {{% button style="transparent" icon="ellipsis-v" %}}{{% /button %}} **more**: opens the overlay if screen space is limited @@ -48,6 +48,14 @@ The value can contain the macro `${FilePath}` which will be replaced by the file editURL = 'https://github.com/McShelby/hugo-theme-relearn/edit/main/exampleSite/content/${FilePath}' {{< /multiconfig >}} +## Print Button + +{{% badge style="cyan" icon="gears" title=" " %}}Option{{% /badge %}} {{% badge style="green" icon="fa-fw fab fa-markdown" title=" " %}}Front Matter{{% /badge %}} You can hide the print button if the [print output format](configuration/sitemanagement/outputformats/#print-support) is active by setting `disablePrintButton=true`. + +{{< multiconfig >}} +disablePrintButton = true +{{< /multiconfig >}} + ## Arrow Navigation {{% badge style="cyan" icon="gears" title=" " %}}Option{{% /badge %}} {{% badge style="green" icon="fa-fw fab fa-markdown" title=" " %}}Front Matter{{% /badge %}} You can hide the previous/next buttons by setting `disableNextPrev=true`. If the buttons are hidden, also the keyboard shortcuts are disabled. diff --git a/exampleSite/content/authoring/frontmatter/topbar/_index.pir.md b/exampleSite/content/authoring/frontmatter/topbar/_index.pir.md index 6b79a0f834..4fc06c5747 100644 --- a/exampleSite/content/authoring/frontmatter/topbar/_index.pir.md +++ b/exampleSite/content/authoring/frontmatter/topbar/_index.pir.md @@ -1,8 +1,8 @@ +++ categories = ["howto"] description = "Configure the topbar" -frontmatter = ["disableBreadcrumb", "disableNextPrev", "disableToc", "editURL"] -options = ["disableBreadcrumb", "disableNextPrev", "disableToc", "editURL"] +frontmatter = ["disableBreadcrumb", "disableNextPrev", "disablePrintButton", "disableToc", "editURL"] +options = ["disableBreadcrumb", "disableNextPrev", "disablePrintButton", "disableToc", "editURL"] title = "Topbarrr" weight = 4 +++ diff --git a/exampleSite/content/configuration/sitemanagement/outputformats/_index.en.md b/exampleSite/content/configuration/sitemanagement/outputformats/_index.en.md index a52a9bcc02..d3f7e0f846 100644 --- a/exampleSite/content/configuration/sitemanagement/outputformats/_index.en.md +++ b/exampleSite/content/configuration/sitemanagement/outputformats/_index.en.md @@ -16,7 +16,7 @@ Enable print support to print entire chapters or the whole site. Add the `print` page = ['html', 'rss', 'print'] {{< /multiconfig >}} -This adds a printer icon in the topbar. Clicking it switches to print preview, showing the page and its [visible subpages](configuration/content/hidden) in a printer-friendly format. Use your browser's print function to print or save as PDF. +By default this adds a printer icon in the topbar by can be [deactived](authoring/frontmatter/topbar/#print-button). Clicking it switches to print preview, showing the page and its [visible subpages](configuration/content/hidden) in a printer-friendly format. Use your browser's print function to print or save as PDF. The URL won't be [configured ugly](https://gohugo.io/templates/output-formats/#configure-output-formats) for [Hugo's URL handling](https://gohugo.io/content-management/urls/#ugly-urls), even with `uglyURLs=true` in `hugo.toml`. This is because each mime type can only have one suffix. diff --git a/exampleSite/content/introduction/releasenotes/7/3.en.md b/exampleSite/content/introduction/releasenotes/7/3.en.md index c53de23e19..1fe8178ddb 100644 --- a/exampleSite/content/introduction/releasenotes/7/3.en.md +++ b/exampleSite/content/introduction/releasenotes/7/3.en.md @@ -11,3 +11,5 @@ weight = -3 ### New - {{% badge style="info" icon="plus-circle" title=" " %}}New{{% /badge %}} Support for Hugo’s built-in [`details` shortcode](https://gohugo.io/content-management/shortcodes/#details) by mapping it to the theme's [`expand` shortcode](shortcodes/expand). + +- {{% badge style="info" icon="plus-circle" title=" " %}}New{{% /badge %}} The topbar button for the print format [can now be hidden](authoring/frontmatter/topbar/#print-button) if the print output format is active by setting `disablePrintButton=true` in your `hugo.toml` or Front Matter. diff --git a/layouts/partials/topbar/button/print.html b/layouts/partials/topbar/button/print.html index d818ab27bc..c95fbc9446 100644 --- a/layouts/partials/topbar/button/print.html +++ b/layouts/partials/topbar/button/print.html @@ -2,8 +2,8 @@ {{- $onwidthm := cond (isset . "onwidthm") .onwidthm "show" }} {{- $onwidthl := cond (isset . "onwidthl") .onwidthl "show" }} {{- with .page }} - {{- $printFormat := .OutputFormats.Get "print" }} - {{- $show := $printFormat }} + {{- $format := .OutputFormats.Get "print" }} + {{- $show := and $format (not (.Param "disablePrintButton")) }} {{- if $show }} {{- $show = not (partial "_relearn/pageIsSpecial.gotmpl" .) }} {{- end }} @@ -11,7 +11,7 @@ {{- partial "topbar/func/button.html" (dict "page" . "class" "topbar-button-print" - "href" $printFormat.RelPermalink + "href" $format.RelPermalink "icon" "print" "onwidths" $onwidths "onwidthm" $onwidthm diff --git a/layouts/partials/version.txt b/layouts/partials/version.txt index 522aaece28..76b2bba4fc 100644 --- a/layouts/partials/version.txt +++ b/layouts/partials/version.txt @@ -1 +1 @@ -7.2.1+49b2f8f770804e95af85e2dfdb515518b4f46821 \ No newline at end of file +7.2.1+d9152f9abaf57fec38d9a8ede67ebbf94303b9e3 \ No newline at end of file