mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2024-11-23 07:47:54 +00:00
include: use Hugo's resources #835
This commit is contained in:
parent
99f33318a2
commit
3a44b61416
7 changed files with 42 additions and 6 deletions
|
@ -1,5 +1,5 @@
|
|||
module.exports = {
|
||||
changelogFilename: "exampleSite/content/basics/CHANGELOG.md",
|
||||
changelogFilename: "CHANGELOG.md",
|
||||
dataSource: "milestones",
|
||||
groupBy: {
|
||||
"Enhancements": [
|
||||
|
|
|
@ -147,7 +147,7 @@ title = "Hugo Relearn Theme"
|
|||
pageRef = "categories/"
|
||||
weight = 50
|
||||
|
||||
# mounts are only needed in this showcase to access the publicly available screenshots;
|
||||
# mounts are only needed in this showcase to access the publicly available screenshots and CHANGELOG;
|
||||
# remove this section if you don't need further mounts
|
||||
[module]
|
||||
[[module.mounts]]
|
||||
|
@ -192,6 +192,10 @@ title = "Hugo Relearn Theme"
|
|||
[[module.mounts]]
|
||||
source = '../images'
|
||||
target = 'assets/images'
|
||||
# just for this documentation to expose the CHANGELOG.md in the docs
|
||||
[[module.mounts]]
|
||||
source = '../CHANGELOG.md'
|
||||
target = 'assets/CHANGELOG.md'
|
||||
|
||||
[params]
|
||||
# Demo setting for displaying the siteparam shortcode the docs.
|
||||
|
|
|
@ -298,6 +298,19 @@ disableHoverBlockCopyToClipBoard = false
|
|||
# individual code blocks.
|
||||
highlightWrap = true
|
||||
|
||||
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
# Include
|
||||
# These options configure how the include shortcode works.
|
||||
|
||||
# What to do when path is not resolved.
|
||||
# Default: ""
|
||||
# You can control what should happen if a path can not be resolved to as
|
||||
# a resource or via the file system. If not set, no output will be written
|
||||
# for the unresolved path. If set to `warning` the same happens and an additional
|
||||
# warning is printed. If set to `error` an error message is printed and the build
|
||||
# is aborted.
|
||||
include.errorlevel = "warning"
|
||||
|
||||
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
# Images
|
||||
# These options configure how images are displayed.
|
||||
|
|
|
@ -3,4 +3,4 @@ disableToc = false
|
|||
title = "History"
|
||||
weight = 30
|
||||
+++
|
||||
{{% include "basics/CHANGELOG.md" true %}}
|
||||
{{% include "CHANGELOG.md" true %}}
|
||||
|
|
|
@ -34,10 +34,12 @@ This document shows you what's new in the latest release and flags it with one o
|
|||
|
||||
- {{% badge style="warning" title=" " %}}Breaking{{% /badge %}} Support for Internet Explorer 11 was finally dropped.
|
||||
|
||||
- {{% badge style="note" title=" " %}}Change{{% /badge %}} Removing support for Internet Explorer 11 finally allowed the theme to upgradte to Font Awesome 6.5.2.
|
||||
- {{% badge style="note" title=" " %}}Change{{% /badge %}} Removing support for Internet Explorer 11 allowed to upgrade Font Awesome to version 6.5.2.
|
||||
|
||||
You may experience slight changes for some icons. In addition you have additional ~1700 icons [to chose](https://fontawesome.com/v6/search?m=free) from.
|
||||
|
||||
- {{% badge style="note" title=" " %}}Change{{% /badge %}} The [`include` shortcode](shortcodes/include) is now able to resolve links to resources as well as to files in the file system (the old behavior). You can configure to generate warnings or errors during build by setting `include.errorlevel` to either `warning` or `error` in your `hugo.toml` if a path can not be resolved.
|
||||
|
||||
- {{% badge style="info" icon="plus-circle" title=" " %}}New{{% /badge %}} Translation into Romanian.
|
||||
|
||||
---
|
||||
|
|
|
@ -4,16 +4,33 @@
|
|||
{{- warnf "%q: DEPRECATED parameter 'context' for shortcode 'include' found, use 'page' instead; see https://mcshelby.github.io/hugo-theme-relearn/basics/migration#5180" $page.File.Filename }}
|
||||
{{- end }}
|
||||
{{- $file := .file }}
|
||||
{{- $content := "" }}
|
||||
{{- with or
|
||||
($page.Resources.Get $file)
|
||||
(resources.Get $file)
|
||||
}}
|
||||
{{- $content = .Content }}
|
||||
{{- else }}
|
||||
{{- if (fileExists $file) }}
|
||||
{{- $content = $file | readFile }}
|
||||
{{- else }}
|
||||
{{- if eq $page.Site.Params.include.errorlevel "warning" }}
|
||||
{{- warnf "%q: file '%s' is not a resource nor accessible via file system" $page.File.Filename $file }}
|
||||
{{- else if eq $page.Site.Params.include.errorlevel "error" }}
|
||||
{{- errorf "%q: image '%s' is not a resource nor accessible via file system" $page.File.Filename $file }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- $hideFirstHeading := .hidefirstheading | default false }}
|
||||
{{- if eq (printf "%T" $hideFirstHeading) "string" }}
|
||||
{{- $hideFirstHeading = (eq $hideFirstHeading "true") }}
|
||||
{{- end }}
|
||||
{{- if and (gt (len (trim $file " ")) 0) (fileExists $file) }}
|
||||
{{- if $content }}
|
||||
{{- if $hideFirstHeading }}<div class="include hide-first-heading">
|
||||
|
||||
{{ end }}
|
||||
{{- with $page }}
|
||||
{{- $file | readFile | safeHTML }}
|
||||
{{- $content | safeHTML }}
|
||||
{{- end }}
|
||||
{{- if $hideFirstHeading }}</div>{{ end }}
|
||||
{{- end }}
|
Loading…
Reference in a new issue