mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-20 21:31:32 +02:00
Merge commit '35dec7c96f7ee3eb17dd444f7067f0c776fb56ae'
This commit is contained in:
@@ -1,6 +0,0 @@
|
||||
<dl>
|
||||
{{ range .Site.Data.docs.chroma.lexers }}
|
||||
<dt>{{ .Name }}</dt>
|
||||
<dd>{{ with .Aliases }}{{ delimit . ", " }}{{ end }}</dd>
|
||||
{{ end }}
|
||||
</dl>
|
@@ -1,101 +0,0 @@
|
||||
{{- /*
|
||||
Renders syntax-highlighted configuration data in JSON, TOML, and YAML formats.
|
||||
|
||||
@param {string} [config] The section of site.Data.docs.config to render.
|
||||
@param {bool} [copy=true] If true, display a copy to clipboard button.
|
||||
@param {string} [file] The file name to display above the rendered code.
|
||||
@param {bool} [fm=false] If true, render the code as front matter.
|
||||
@param {bool} [skipHeader=false] If false, omit top level key(s) when rendering a section of site.Data.docs.config.
|
||||
|
||||
@returns {template.HTML}
|
||||
*/}}
|
||||
|
||||
{{- /* Initialize. */}}
|
||||
{{- $config := "" }}
|
||||
{{- $dataKey := "" }}
|
||||
{{- $copy := true }}
|
||||
{{- $file := "" }}
|
||||
{{- $fm := false }}
|
||||
{{- $skipHeader := false }}
|
||||
|
||||
{{- /* Get parameters. */}}
|
||||
{{- $config = .Get "config" }}
|
||||
{{- $dataKey = .Get "dataKey" }}
|
||||
{{- $file = .Get "file" }}
|
||||
{{- if in (slice "false" false 0) (.Get "copy") }}
|
||||
{{- $copy = false }}
|
||||
{{- else if in (slice "true" true 1) (.Get "copy") }}
|
||||
{{- $copy = true }}
|
||||
{{- end }}
|
||||
{{- if in (slice "false" false 0) (.Get "fm") }}
|
||||
{{- $fm = false }}
|
||||
{{- else if in (slice "true" true 1) (.Get "fm") }}
|
||||
{{- $fm = true }}
|
||||
{{- end }}
|
||||
{{- if in (slice "false" false 0) (.Get "skipHeader") }}
|
||||
{{- $skipHeader = false }}
|
||||
{{- else if in (slice "true" true 1) (.Get "skipHeader") }}
|
||||
{{- $skipHeader = true }}
|
||||
{{- end }}
|
||||
|
||||
{{- /* Define constants. */}}
|
||||
{{- $delimiters := dict "toml" "+++" "yaml" "---" }}
|
||||
{{- $langs := slice "yaml" "toml" "json" }}
|
||||
{{- $placeHolder := "#-hugo-placeholder-#" }}
|
||||
|
||||
{{- /* Render. */}}
|
||||
{{- $code := "" }}
|
||||
{{- if $config }}
|
||||
{{- $file = $file | default "hugo" }}
|
||||
{{- $sections := (split $config ".") }}
|
||||
{{- $configSection := index $.Site.Data.docs.config $sections }}
|
||||
{{- $code = dict $sections $configSection }}
|
||||
{{- if $skipHeader }}
|
||||
{{- $code = $configSection }}
|
||||
{{- end }}
|
||||
{{- else if $dataKey }}
|
||||
{{- $file = $file | default $dataKey }}
|
||||
{{- $sections := (split $dataKey ".") }}
|
||||
{{- $code = index $.Site.Data.docs $sections }}
|
||||
{{- else }}
|
||||
{{- $code = $.Inner }}
|
||||
{{- end }}
|
||||
<div class="code relative" {{ with $file }}id="{{ . | urlize }}"{{ end }}>
|
||||
<div class="code-nav flex flex-nowrap items-stretch">
|
||||
{{- with $file }}
|
||||
<div class="san-serif f6 dib lh-solid pl2 pv2 mr2">
|
||||
{{ . }}{{ if not $fm }}.{{ end }}
|
||||
</div>
|
||||
{{- end }}
|
||||
{{- range $langs }}
|
||||
<button
|
||||
data-toggle-tab="{{ . }}"
|
||||
class="tab-button {{ cond (eq . "yaml") "active" "" }} ba san-serif f6 dib lh-solid ph2 pv2">
|
||||
{{ . }}
|
||||
</button>
|
||||
|
||||
{{- end }}
|
||||
</div>
|
||||
<div class="tab-content">
|
||||
{{- range $langs }}
|
||||
<div
|
||||
data-pane="{{ . }}"
|
||||
class="code-copy-content nt3 tab-pane {{ cond (eq . "yaml") "active" "" }}">
|
||||
{{- $hCode := $code | transform.Remarshal . }}
|
||||
{{- if and $fm (in (slice "toml" "yaml") .) }}
|
||||
{{- $hCode = printf "%s\n%s\n%s" $placeHolder $hCode $placeHolder }}
|
||||
{{- end }}
|
||||
{{- $hCode = $hCode | replaceRE `\n+` "\n" }}
|
||||
{{ highlight $hCode . "" | replaceRE $placeHolder (index $delimiters .) | safeHTML }}
|
||||
</div>
|
||||
{{- if $copy }}
|
||||
<button
|
||||
class="needs-js copy copy-toggle bg-accent-color-dark f6 absolute top-0 right-0 lh-solid hover-bg-primary-color-dark bn white ph3 pv2"
|
||||
title="Copy this code to your clipboard."
|
||||
data-clipboard-action="copy"
|
||||
aria-label="copy button"></button>
|
||||
{{- /* Functionality located within filesaver.js The copy here is located in the css with .copy class so it can be replaced with JS on success */}}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
</div>
|
||||
</div>
|
@@ -1,39 +0,0 @@
|
||||
{{- /*
|
||||
Renders syntax highlighted code.
|
||||
|
||||
@param {bool} [copy=true] If true, display a copy to clipboard button.
|
||||
@param {string} [file] The file name to display above the rendered code.
|
||||
@param {string} [lang] The code language of the inner content.
|
||||
|
||||
@returns {template.HTML}
|
||||
*/}}
|
||||
|
||||
{{- /* Initialize. */}}
|
||||
{{- $copy := true }}
|
||||
{{- $file := " " }}
|
||||
{{- $lang := "" }}
|
||||
|
||||
{{- /* Get parameters. */}}
|
||||
{{- $file = .Get "file" }}
|
||||
{{- $lang = or (.Get "lang") (path.Ext $file | strings.TrimPrefix ".") "text" }}
|
||||
{{- if in (slice "false" false 0) (.Get "copy") }}
|
||||
{{- $copy = false }}
|
||||
{{- else if in (slice "true" true 1) (.Get "copy")}}
|
||||
{{- $copy = true }}
|
||||
{{- end }}
|
||||
|
||||
{{- /* Use the go-html-template Chroma lexer for HTML. */}}
|
||||
{{- if eq $lang "html" }}
|
||||
{{- $lang = "go-html-template" }}
|
||||
{{- end }}
|
||||
|
||||
{{- /* Render. */}}
|
||||
<div class="code relative" id="{{ $file | urlize }}">
|
||||
<div class="f6 dib lh-solid pl2 pv2">{{ or $file "nbsp;" }}</div>
|
||||
{{- if $copy }}
|
||||
<button class="needs-js copy bg-accent-color-dark f6 absolute top-0 right-0 lh-solid hover-bg-primary-color-dark bn white ph3 pv2" title="Copy this code to your clipboard." data-clipboard-action="copy" aria-label="copy button"></button>
|
||||
{{- end }}
|
||||
<div class="code-copy-content nt3">
|
||||
{{- highlight (trim .Inner "\n\r") $lang }}
|
||||
</div>
|
||||
</div>
|
@@ -1,39 +0,0 @@
|
||||
{{ $package := (index .Params 0) }}
|
||||
{{ $listname := (index .Params 1) }}
|
||||
{{ $filter := split (index .Params 2) " " }}
|
||||
{{ $filter1 := index $filter 0 }}
|
||||
{{ $filter2 := index $filter 1 }}
|
||||
{{ $filter3 := index $filter 2 }}
|
||||
|
||||
{{ $list := (index (index .Site.Data.docs $package) $listname) }}
|
||||
{{ $fields := after 3 .Params }}
|
||||
{{ $list := where $list $filter1 $filter2 $filter3 }}
|
||||
|
||||
<table class="table table-bordered">
|
||||
<tr>
|
||||
{{ range $fields }}
|
||||
<th>{{ . }}</th>
|
||||
{{ end }}
|
||||
</tr>
|
||||
{{ range $list }}
|
||||
<tr>
|
||||
{{ range $k, $v := . }}
|
||||
{{ $.Scratch.Set $k $v }}
|
||||
{{ end }}
|
||||
{{ range $k, $v := $fields }}
|
||||
<td>
|
||||
{{ $tdContent := $.Scratch.Get . }}
|
||||
{{ if eq $k 3 }}
|
||||
{{ printf "%v" $tdContent |
|
||||
strings.ReplaceRE `\[` "<ol><li>" |
|
||||
strings.ReplaceRE `\s` "</li><li>" |
|
||||
strings.ReplaceRE `\]` "</li></ol>" |
|
||||
safeHTML }}
|
||||
{{ else }}
|
||||
{{ $tdContent }}
|
||||
{{ end}}
|
||||
</td>
|
||||
{{ end }}
|
||||
</tr>
|
||||
{{ end }}
|
||||
</table>
|
@@ -1,33 +0,0 @@
|
||||
{{ $package := (index .Params 0) }}
|
||||
{{ $listname := (index .Params 1) }}
|
||||
{{ $list := (index (index .Site.Data.docs $package) $listname) }}
|
||||
{{ $fields := after 2 .Params }}
|
||||
|
||||
|
||||
<table class="table table-bordered">
|
||||
<tr>
|
||||
{{ range $fields }}
|
||||
{{ $s := . }}
|
||||
{{ if eq $s "_key" }}
|
||||
{{ $s = "Type" }}
|
||||
{{ end }}
|
||||
<th>{{ $s }}</th>
|
||||
{{ end }}
|
||||
</tr>
|
||||
{{ range $k1, $v1 := $list }}
|
||||
<tr>
|
||||
{{ range $k2, $v2 := . }}
|
||||
{{ $.Scratch.Set $k2 $v2 }}
|
||||
{{ end }}
|
||||
{{ range $fields }}
|
||||
{{ $s := "" }}
|
||||
{{ if eq . "_key" }}
|
||||
{{ $s = $k1 }}
|
||||
{{ else }}
|
||||
{{ $s = $.Scratch.Get . }}
|
||||
{{ end }}
|
||||
<td>{{ $s }}</td>
|
||||
{{ end }}
|
||||
</tr>
|
||||
{{ end }}
|
||||
</table>
|
@@ -1,4 +0,0 @@
|
||||
<h4 class="minor mb1 pt2 primary-color-dark">Syntax</h4>
|
||||
<pre class="f5 mb4 ph3 pv2 bg-light-gray overflow-x-auto" style="border-left:4px solid #0594CB;">
|
||||
{{- .Inner -}}
|
||||
</pre>
|
@@ -1,21 +0,0 @@
|
||||
<!-- {{/*
|
||||
Insert `.Content` from a (headless) bundle. You can insert `.Content` from multiple page resources of the same bundle by specifying `glob`.
|
||||
|
||||
Usage: {{< getcontent path="PATH/TO/FILE" >}}
|
||||
{{< getcontent path="PATH/TO/BUNDLE/" glob="*_PATTERN.md" >}}
|
||||
*/}} -->
|
||||
{{- $path := .Get "path" -}}
|
||||
{{ $glob := .Get "glob" -}}
|
||||
|
||||
{{ $resources := slice -}}
|
||||
{{ with $glob -}}
|
||||
{{ $bundle := site.GetPage $path -}}
|
||||
{{ $resources = $bundle.Resources.Match $glob -}}
|
||||
{{ else -}}
|
||||
{{ $bundle := site.GetPage (path.Dir $path) -}}
|
||||
{{ $resources = $bundle.Resources.Match (path.Base $path) -}}
|
||||
{{ end -}}
|
||||
|
||||
{{ range $resources -}}
|
||||
{{ .Content }}
|
||||
{{ end -}}
|
@@ -1,17 +0,0 @@
|
||||
{{ $text := `
|
||||
Most of the commands for **Hugo Modules** require a newer version of Go installed (see https://golang.org/dl/) and the relevant VCS client (e.g. Git, see https://git-scm.com/downloads/ ). If you have an "older" site running on Netlify, you may have to set GO_VERSION to 1.12 in your Environment settings.
|
||||
|
||||
For more information about Go Modules, see:
|
||||
|
||||
* https://github.com/golang/go/wiki/Modules
|
||||
* https://blog.golang.org/using-go-modules
|
||||
` }}
|
||||
|
||||
<aside class="admonition note">
|
||||
<div class="note-icon">
|
||||
{{partial "svg/exclamation.svg" (dict "size" "20px" ) }}
|
||||
</div>
|
||||
<div class="admonition-content">
|
||||
{{- $text | markdownify -}}
|
||||
</div>
|
||||
</aside>
|
@@ -1,26 +0,0 @@
|
||||
{{ $img := .Page.Resources.GetMatch (printf "*%s*" (.Get 0)) }}
|
||||
{{ $command := .Get 1 }}
|
||||
{{ $options := .Get 2 }}
|
||||
{{ if eq $command "Fit"}}
|
||||
{{ $img = $img.Fit $options }}
|
||||
{{ else if eq $command "Resize"}}
|
||||
{{ $img = $img.Resize $options }}
|
||||
{{ else if eq $command "Fill"}}
|
||||
{{ $img = $img.Fill $options }}
|
||||
{{ else if eq $command "Crop"}}
|
||||
{{ $img = $img.Crop $options }}
|
||||
{{ else }}
|
||||
{{ errorf "Invalid image processing command: Must be one of Crop, Fit, Fill or Resize."}}
|
||||
{{ end }}
|
||||
<figure style="padding: 0.25rem; margin: 2rem 0; background-color: #cccc">
|
||||
<img style="max-width: 100%; width: auto; height: auto;" src="{{ $img.RelPermalink }}" width="{{ $img.Width }}" height="{{ $img.Height }}">
|
||||
<figcaption>
|
||||
<small>
|
||||
{{ with .Inner }}
|
||||
{{ . }}
|
||||
{{ else }}
|
||||
.{{ $command }} "{{ $options }}"
|
||||
{{ end }}
|
||||
</small>
|
||||
</figcaption>
|
||||
</figure>
|
@@ -1 +0,0 @@
|
||||
Also see [Module Mounts Config](/hugo-modules/configuration/#module-configuration-mounts) for an alternative way to configure this directory (from Hugo 0.56).
|
@@ -1,13 +1,36 @@
|
||||
{{ $version := .Get 0 }}
|
||||
{{ if not $version }}
|
||||
{{ errorf "Missing version in new-in shortcode " }}
|
||||
{{ end }}
|
||||
{{ $version = $version | strings.TrimPrefix "v" }}
|
||||
<button
|
||||
class="bg-white hover:bg-gray-100 text-gray-800 font-semibold py-2 mr2 ml2 px-4 border border-gray-400 rounded shadow">
|
||||
<a
|
||||
href="{{ printf "https://github.com/gohugoio/hugo/releases/tag/v%s" $version }}"
|
||||
target="_blank"
|
||||
>New in v{{ $version }}</a
|
||||
>
|
||||
</button>
|
||||
{{- /*
|
||||
Renders a "new in" button indicating the version in which a feature was added.
|
||||
|
||||
When comparing the current version to the specified version, the "new in"
|
||||
button will be hidden if any of the following conditions is true:
|
||||
|
||||
- The major version difference exceeds the majorVersionDiffThreshold
|
||||
- The minor version difference exceeds the minorVersionDiffThreshold
|
||||
|
||||
@param {string} version The semantic version string, with or without a leading v.
|
||||
@returns {template.HTML}
|
||||
|
||||
@example {{< new-in 0.100.0 >}}
|
||||
*/}}
|
||||
|
||||
{{- /* Set defaults. */}}
|
||||
{{- $majorVersionDiffThreshold := 0 }}
|
||||
{{- $minorVersionDiffThreshold := 30 }}
|
||||
{{- $displayExpirationWarning := true }}
|
||||
|
||||
{{- /* Render. */}}
|
||||
{{- with $version := .Get 0 | strings.TrimPrefix "v" }}
|
||||
{{- $majorVersionDiff := sub (index (split hugo.Version ".") 0 | int) (index (split $version ".") 0 | int) }}
|
||||
{{- $minorVersionDiff := sub (index (split hugo.Version ".") 1 | int) (index (split $version ".") 1 | int) }}
|
||||
{{- if or (gt $majorVersionDiff $majorVersionDiffThreshold) (gt $minorVersionDiff $minorVersionDiffThreshold) }}
|
||||
{{- if $displayExpirationWarning }}
|
||||
{{- warnf "This call to the %q shortcode should be removed: %s. The button is now hidden because the specified version (%s) is older than the display threshold." $.Name $.Position $version }}
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
<button class="bg-white hover:bg-gray-100 text-gray-800 font-semibold py-2 mr2 px-4 border border-gray-400 rounded shadow">
|
||||
<a href="{{ printf "https://github.com/gohugoio/hugo/releases/tag/v%s" $version }}">New in v{{ $version }}</a>
|
||||
</button>
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
{{- errorf "The %q shortcode requires a positional parameter (version). See %s" .Name .Position }}
|
||||
{{- end -}}
|
||||
|
@@ -1,7 +0,0 @@
|
||||
| Kind | Description | Example |
|
||||
|----------------|--------------------------------------------------------------------|-------------------------------------------------------------------------------|
|
||||
| `home` | The landing page for the home page | `/index.html` |
|
||||
| `page` | The landing page for a given page | `my-post` page (`/posts/my-post/index.html`) |
|
||||
| `section` | The landing page of a given section | `posts` section (`/posts/index.html`) |
|
||||
| `taxonomy` | The landing page for a taxonomy | `tags` taxonomy (`/tags/index.html`) |
|
||||
| `term` | The landing page for one taxonomy's term | term `awesome` in `tags` taxonomy (`/tags/awesome/index.html`) |
|
@@ -1,8 +0,0 @@
|
||||
{{$file := .Get "file"}}
|
||||
{{- if eq (.Get "markdown") "true" -}}
|
||||
{{- $file | readFile | markdownify -}}
|
||||
{{- else if (.Get "highlight") -}}
|
||||
{{- highlight ($file | readFile) (.Get "highlight") "" -}}
|
||||
{{- else -}}
|
||||
{{ $file | readFile | safeHTML }}
|
||||
{{- end -}}
|
@@ -1 +0,0 @@
|
||||
{{ if .Inner }}{{ end }}
|
Reference in New Issue
Block a user