mirror of
https://github.com/gohugoio/hugo.git
synced 2026-08-24 15:28:54 +00:00
Replace tip and warning shortcode calls
This commit is contained in:
@@ -87,9 +87,9 @@ respectDoNotTrack
|
||||
useSessionStorage
|
||||
: Enabling this will disable the use of Cookies and use Session Storage to Store the GA Client ID.
|
||||
|
||||
{{% warning %}}
|
||||
{{% note %}}
|
||||
`useSessionStorage` is not supported when using Google Analytics v4 (gtag.js).
|
||||
{{% /warning %}}
|
||||
{{% /note %}}
|
||||
|
||||
### Instagram
|
||||
|
||||
|
||||
@@ -46,9 +46,9 @@ Hugo passes reasonable default arguments to these external helpers by default:
|
||||
- `rst2html`: `--leave-comments --initial-header-level=2`
|
||||
- `pandoc`: `--mathjax`
|
||||
|
||||
{{% warning "Performance of External Helpers" %}}
|
||||
{{% note %}}
|
||||
Because additional formats are external commands, generation performance will rely heavily on the performance of the external tool you are using. As this feature is still in its infancy, feedback is welcome.
|
||||
{{% /warning %}}
|
||||
{{% /note %}}
|
||||
|
||||
### External Helper AsciiDoc
|
||||
|
||||
|
||||
@@ -126,9 +126,9 @@ Resources of type `page` get `Title` etc. from their own front matter.
|
||||
name
|
||||
: Sets the value returned in `Name`.
|
||||
|
||||
{{% warning %}}
|
||||
{{% note %}}
|
||||
The methods `Match`, `Get` and `GetMatch` use `Name` to match the resources.
|
||||
{{%/ warning %}}
|
||||
{{% /note %}}
|
||||
|
||||
title
|
||||
: Sets the value returned in `Title`
|
||||
@@ -172,9 +172,9 @@ From the example above:
|
||||
- All `PDF` files will get a new `Name`. The `name` parameter contains a special placeholder [`:counter`](#the-counter-placeholder-in-name-and-title), so the `Name` will be `pdf-file-1`, `pdf-file-2`, `pdf-file-3`.
|
||||
- Every docx in the bundle will receive the `word` icon.
|
||||
|
||||
{{% warning %}}
|
||||
{{% note %}}
|
||||
The __order matters__ --- Only the **first set** values of the `title`, `name` and `params`-**keys** will be used. Consecutive parameters will be set only for the ones not already set. In the above example, `.Params.icon` is first set to `"photo"` in `src = "documents/photo_specs.pdf"`. So that would not get overridden to `"pdf"` by the later set `src = "**.pdf"` rule.
|
||||
{{%/ warning %}}
|
||||
{{% /note %}}
|
||||
|
||||
### The `:counter` placeholder in `name` and `title`
|
||||
|
||||
|
||||
@@ -350,13 +350,13 @@ Using the preceding `vimeo` example, the following HTML will be added to your re
|
||||
{{< vimeo 146022717 >}}
|
||||
{{< /output >}}
|
||||
|
||||
{{% tip %}}
|
||||
{{% note %}}
|
||||
If you want to further customize the visual styling of the YouTube or Vimeo output, add a `class` named parameter when calling the shortcode. The new `class` will be added to the `<div>` that wraps the `<iframe>` *and* will remove the inline styles. Note that you will need to call the `id` as a named parameter as well. You can also give the vimeo video a descriptive title with `title`.
|
||||
|
||||
```go
|
||||
{{</* vimeo id="146022717" class="my-vimeo-wrapper-class" title="My vimeo video" */>}}
|
||||
```
|
||||
{{% /tip %}}
|
||||
{{% /note %}}
|
||||
|
||||
#### Example `vimeo` Display
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ Cons
|
||||
|
||||
{{% warning "Be Precise with the Summary Divider" %}}
|
||||
Be careful to enter <code><!--more--></code> exactly; i.e., all lowercase and with no whitespace.
|
||||
{{% /warning %}}
|
||||
{{% /note %}}
|
||||
|
||||
### Front Matter Summary
|
||||
|
||||
@@ -77,7 +77,7 @@ Because there are multiple ways in which a summary can be specified it is useful
|
||||
|
||||
{{% warning "Competing selections" %}}
|
||||
Hugo uses the _first_ of the above steps that returns text. So if, for example, your article has both `summary` variable in its front matter and a <code><!--more--></code> summary divider Hugo will use the manual summary split method.
|
||||
{{% /warning %}}
|
||||
{{% /note %}}
|
||||
|
||||
## Example: First 10 Articles with Summaries
|
||||
|
||||
|
||||
@@ -137,11 +137,11 @@ You can add content and front matter to your taxonomy list and taxonomy terms pa
|
||||
Much like regular pages, taxonomy list [permalinks](/content-management/urls/) are configurable, but taxonomy term page permalinks are not.
|
||||
{{% /note %}}
|
||||
|
||||
{{% warning %}}
|
||||
{{% note %}}
|
||||
The configuration option `preserveTaxonomyNames` was removed in Hugo 0.55.
|
||||
|
||||
You can now use `.Page.Title` on the relevant taxonomy node to get the original value.
|
||||
{{% /warning %}}
|
||||
{{% /note %}}
|
||||
|
||||
## Add Taxonomies to Content
|
||||
|
||||
|
||||
@@ -312,7 +312,7 @@ git commit --amend
|
||||
|
||||
{{% warning "Be Careful Modifying Multiple Commits"%}}
|
||||
Modifications such as those described in this section can have serious unintended consequences. Skip this section if you're not sure!
|
||||
{{% /warning %}}
|
||||
{{% /note %}}
|
||||
|
||||
This is a bit more advanced. Git allows you to [rebase](https://git-scm.com/docs/git-rebase) commits interactively. In other words: it allows you to rewrite the commit history.
|
||||
|
||||
|
||||
@@ -19,8 +19,8 @@ Example:
|
||||
|
||||
Would emit "goose" if the `$geese` array has exactly 1 item, or "geese" otherwise.
|
||||
|
||||
{{% warning %}}
|
||||
{{% note %}}
|
||||
Whenever you use a `cond` function, *both* variable expressions are *always* evaluated. This means that a usage like `cond false (div 1 0) 27` will throw an error because `div 1 0` will be evaluated *even though the condition is false*.
|
||||
|
||||
In other words, the `cond` function does *not* provide [short-circuit evaluation](https://en.wikipedia.org/wiki/Short-circuit_evaluation) and does *not* work like a normal [ternary operator](https://en.wikipedia.org/wiki/%3F:) that will pass over the first expression if the condition returns `false`.
|
||||
{{% /warning %}}
|
||||
{{% /note %}}
|
||||
|
||||
@@ -16,7 +16,7 @@ Takes either a slice, array, or channel and an index or a map and a key as input
|
||||
{{ if isset .Params "project_url" }} {{ index .Params "project_url" }}{{ end }}
|
||||
```
|
||||
|
||||
{{% warning %}}
|
||||
{{% note %}}
|
||||
All site-level configuration keys are stored as lower case. Therefore, a `myParam` key-value set in your [site configuration file](/getting-started/configuration/) needs to be accessed with `{{ if isset .Site.Params "myparam" }}` and *not* with `{{ if isset .Site.Params "myParam" }}`. Note that you can still access the same config key with `.Site.Params.myParam` *or* `.Site.Params.myparam`, for example, when using [`with`](/functions/with).
|
||||
This restriction also applies when accessing page-level front matter keys from within [shortcodes](/content-management/shortcodes/).
|
||||
{{% /warning %}}
|
||||
{{% /note %}}
|
||||
|
||||
@@ -115,9 +115,9 @@ noVendor
|
||||
When the `mounts` config was introduced in Hugo 0.56.0, we were careful to preserve the existing `contentDir`, `staticDir`, and similar configuration to make sure all existing sites just continued to work. But you should not have both: if you add a `mounts` section you should remove the old `contentDir`, `staticDir`, etc. settings.
|
||||
{{% /note %}}
|
||||
|
||||
{{% warning %}}
|
||||
{{% note %}}
|
||||
When you add a mount, the default mount for the concerned target root is ignored: be sure to explicitly add it.
|
||||
{{% /warning %}}
|
||||
{{% /note %}}
|
||||
|
||||
**Default mounts**
|
||||
{{< code-toggle file="config">}}
|
||||
|
||||
@@ -66,7 +66,7 @@ From the above base template, you can define a [default list template][hugolists
|
||||
|
||||
This replaces the contents of our (basically empty) "main" block with something useful for the list template. In this case, we didn't define a `"title"` block, so the contents from our base template remain unchanged in lists.
|
||||
|
||||
{{% warning %}}
|
||||
{{% note %}}
|
||||
Code that you put outside the block definitions *can* break your layout. This even includes HTML comments. For example:
|
||||
|
||||
```go-html-template
|
||||
@@ -76,7 +76,7 @@ Code that you put outside the block definitions *can* break your layout. This ev
|
||||
{{ end }}
|
||||
```
|
||||
[See this thread from the Hugo discussion forums.](https://discourse.gohugo.io/t/baseof-html-block-templates-and-list-types-results-in-empty-pages/5612/6)
|
||||
{{% /warning %}}
|
||||
{{% /note %}}
|
||||
|
||||
The following shows how you can override both the `"main"` and `"title"` block areas from the base template with code unique to your [default single page template][singletemplate]:
|
||||
|
||||
|
||||
@@ -237,7 +237,7 @@ There is no chance to trigger a [LiveReload] when the content of a URL changes.
|
||||
|
||||
{{% warning "URL Data and LiveReload" %}}
|
||||
If you change any local file and the LiveReload is triggered, Hugo will read the data-driven (URL) content from the cache. If you have disabled the cache (i.e., by running the server with `hugo server --ignoreCache`), Hugo will re-download the content every time LiveReload triggers. This can create *huge* traffic. You may reach API limits quickly.
|
||||
{{% /warning %}}
|
||||
{{% /note %}}
|
||||
|
||||
## Examples of Data-driven Content
|
||||
|
||||
|
||||
@@ -43,9 +43,9 @@ As `readFile` is a function, it is only available to you in your templates and n
|
||||
{{</* readfile file="/path/to/local/file.txt" markdown="true" */>}}
|
||||
```
|
||||
|
||||
{{% warning %}}
|
||||
{{% note %}}
|
||||
If you are going to create [custom shortcodes](/templates/shortcode-templates/) with `readFile` for a theme, note that usage of the shortcode will refer to the project root and *not* your `themes` directory.
|
||||
{{% /warning %}}
|
||||
{{% /note %}}
|
||||
|
||||
[called directly in the Hugo docs]: https://github.com/gohugoio/hugoDocs/blob/master/content/en/templates/files.md
|
||||
[osfileinfo]: https://golang.org/pkg/os/#FileInfo
|
||||
|
||||
@@ -13,9 +13,9 @@ toc: true
|
||||
<!-- reference: https://discourse.gohugo.io/t/lookup-order-for-partials/5705/6
|
||||
code: https://github.com/gohugoio/hugo/blob/e445c35d6a0c7f5fc2f90f31226cd1d46e048bbc/tpl/template_embedded.go#L147 -->
|
||||
|
||||
{{% warning %}}
|
||||
{{% note %}}
|
||||
While the following internal templates are called similar to partials, they do *not* observe the partial template lookup order.
|
||||
{{% /warning %}}
|
||||
{{% /note %}}
|
||||
|
||||
## Google Analytics
|
||||
|
||||
|
||||
@@ -429,7 +429,7 @@ Notice how once we have entered the loop (i.e. `range`), the value of `{{ . }}`
|
||||
|
||||
{{% warning "Don't Redefine the Dot" %}}
|
||||
The built-in magic of `$` would cease to work if someone were to mischievously redefine the special character; e.g. `{{ $ := .Site }}`. *Don't do it.* You may, of course, recover from this mischief by using `{{ $ := . }}` in a global context to reset `$` to its default value.
|
||||
{{% /warning %}}
|
||||
{{% /note %}}
|
||||
|
||||
## Whitespace
|
||||
|
||||
|
||||
@@ -31,9 +31,9 @@ Setting `paginate` to a positive value will split the list pages for the homepag
|
||||
|
||||
## List Paginator Pages
|
||||
|
||||
{{% warning %}}
|
||||
{{% note %}}
|
||||
`.Paginator` is provided to help you build a pager menu. This feature is currently only supported on homepage and list pages (i.e., taxonomies and section lists).
|
||||
{{% /warning %}}
|
||||
{{% /note %}}
|
||||
|
||||
There are two ways to configure and use a `.Paginator`:
|
||||
|
||||
|
||||
@@ -102,10 +102,10 @@ A shortcode with content declared via the `.Inner` variable can also be declared
|
||||
{{</* innershortcode /*/>}}
|
||||
```
|
||||
|
||||
{{% warning %}}
|
||||
{{% note %}}
|
||||
Any shortcode that refers to `.Inner` must be closed or self-closed.
|
||||
|
||||
{{% /warning %}}
|
||||
{{% /note %}}
|
||||
|
||||
#### `.Params`
|
||||
|
||||
@@ -142,9 +142,9 @@ You could then include the following as part of your shortcode templating:
|
||||
|
||||
See the [example Vimeo shortcode][vimeoexample] below for `.IsNamedParams` in action.
|
||||
|
||||
{{% warning %}}
|
||||
{{% note %}}
|
||||
While you can create shortcode templates that accept both positional and named parameters, you *cannot* declare shortcodes in content with a mix of parameter types. Therefore, a shortcode declared like `{{</* image src="images/my-image.jpg" "This is my alt text" */>}}` will return an error.
|
||||
{{% /warning %}}
|
||||
{{% /note %}}
|
||||
|
||||
You can also use the variable `.Page` to access all the normal [page variables][pagevars].
|
||||
|
||||
|
||||
@@ -78,10 +78,10 @@ the desired output, the template may benefit from caching to reduce the number
|
||||
of executions. The [`partialCached`][partialcached] template function provides
|
||||
caching capabilities for `partial` templates.
|
||||
|
||||
{{% tip %}}
|
||||
{{% note %}}
|
||||
Note that you can create cached variants of each `partial` by passing additional
|
||||
parameters to `partialCached` beyond the initial context. See the
|
||||
`partialCached` documentation for more details.
|
||||
{{% /tip %}}
|
||||
{{% /note %}}
|
||||
|
||||
[partialCached]: /functions/partialCached
|
||||
|
||||
Reference in New Issue
Block a user