mirror of
https://github.com/tiennm99/hugoDocs.git
synced 2026-10-14 10:18:40 +00:00
content: Replace calls to the code shortcode with fenced code blocks
This commit is contained in:
1 parent
b23c9a583a
commit
fd628be6ed
110 files changed
+483
-555
No files matched your search
@@ -14,19 +14,19 @@ This is useful for inheritance of common shortcode arguments from the root.
|
||||
|
||||
In this contrived example, the "greeting" shortcode is the parent, and the "now" shortcode is child.
|
||||
|
||||
{{< code file=content/welcome.md lang=text >}}
|
||||
```text {file="content/welcome.md"}
|
||||
{{</* greeting dateFormat="Jan 2, 2006" */>}}
|
||||
Welcome. Today is {{</* now */>}}.
|
||||
{{</* /greeting */>}}
|
||||
{{< /code >}}
|
||||
```
|
||||
|
||||
{{< code file=layouts/shortcodes/greeting.html >}}
|
||||
```go-html-template {file="layouts/shortcodes/greeting.html"}
|
||||
<div class="greeting">
|
||||
{{ .Inner | strings.TrimSpace | .Page.RenderString }}
|
||||
</div>
|
||||
{{< /code >}}
|
||||
```
|
||||
|
||||
{{< code file=layouts/shortcodes/now.html >}}
|
||||
```go-html-template {file="layouts/shortcodes/now.html"}
|
||||
{{- $dateFormat := "January 2, 2006 15:04:05" }}
|
||||
|
||||
{{- with .Params }}
|
||||
@@ -42,7 +42,7 @@ Welcome. Today is {{</* now */>}}.
|
||||
{{- end }}
|
||||
|
||||
{{- now | time.Format $dateFormat -}}
|
||||
{{< /code >}}
|
||||
```
|
||||
|
||||
The "now" shortcode formats the current time using:
|
||||
|
||||
|
||||
Reference in new issue
Block a user