Skip to content

Commit

Permalink
Add shortcode rendering in readfile shortcode
Browse files Browse the repository at this point in the history
This allows to importing files that contain shortcodes themselves, and
the shortcodes will be rendered correctly.

Requires Hugo v0.101.0+
  • Loading branch information
geriom committed Aug 29, 2022
1 parent 219c2db commit 4e07338
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion layouts/shortcodes/readfile.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
{{- highlight ($.Scratch.Get "filepath" | readFile | htmlUnescape |
safeHTML ) (.Get "lang") "" -}}
{{ else }}
{{- $.Scratch.Get "filepath" | readFile | htmlUnescape | safeHTML -}}
{{- $.Scratch.Get "filepath" | readFile | .Page.RenderString | htmlUnescape | safeHTML -}}
{{ end }}
{{ else }}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
**Installation**

{{% alert title="Note" color="primary" %}}
Check system compatibility before proceeding.
{{% /alert %}}

1. Download the installation files.

1. Run the installation script
Expand Down
4 changes: 4 additions & 0 deletions userguide/content/en/docs/adding-content/shortcodes/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,10 @@ contents:
```go-html-template
## Installation
{{%/* alert title="Note" color="primary" */%}}
Check system compatibility before proceeding.
{{%/* /alert */%}}
1. Download the installation files.
1. Run the installation script
Expand Down

0 comments on commit 4e07338

Please sign in to comment.