Skip to content

Commit

Permalink
List template functions by namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
jmooring committed Oct 15, 2023
1 parent 4bf0c71 commit 1b8184a
Show file tree
Hide file tree
Showing 483 changed files with 9,742 additions and 3,474 deletions.
2 changes: 1 addition & 1 deletion .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@
"مدونتي"
],
"language": "en,en-US,de,fr",
"allowCompoundWords": true,
"allowCompoundWords": false,
"files": [
"**/*.md"
],
Expand Down
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,11 @@ Spelling fixes are most welcomed, and if you want to contribute longer sections
* For example, try to find short snippets that teaches people about the concept. If the example is also useful as-is (copy and paste), then great. Don't list long and similar examples just so people can use them on their sites.
* Hugo has users from all over the world, so easy to understand and [simple English](https://simple.wikipedia.org/wiki/Basic_English) is good.


## Edit the theme

If you want to do docs-related theme changes, the simplest way is to have both `hugoDocs` and `gohugoioTheme` cloned as sibling directories, and then run:

```
```sh
HUGO_MODULE_WORKSPACE=hugo.work hugo server --ignoreVendorPaths "**"
```

Expand All @@ -37,15 +36,15 @@ HUGO_MODULE_WORKSPACE=hugo.work hugo server --ignoreVendorPaths "**"

To view the documentation site locally, you need to clone this repository:

```bash
```sh
git clone https://github.com/gohugoio/hugoDocs.git
```

Also note that the documentation version for a given version of Hugo can also be found in the `/docs` sub-folder of the [Hugo source repository](https://github.com/gohugoio/hugo).

Then to view the docs in your browser, run Hugo and open up the link:

```bash
```sh
▶ hugo server

Started building sites ...
Expand Down
9 changes: 3 additions & 6 deletions archetypes/functions.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
---
title: {{ replace .File.ContentBaseName "-" " " | title }}
description:
categories: [functions]
categories: []
keywords: []
menu:
docs:
parent: functions
function:
action:
aliases: []
related: []
returnType:
signatures: []
relatedFunctions: []
---
10 changes: 10 additions & 0 deletions archetypes/methods.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
title: {{ replace .File.ContentBaseName "-" " " | title }}
description:
categories: []
keywords: []
action:
related: []
returnType:
signatures: []
---
5 changes: 2 additions & 3 deletions archetypes/showcase/bio.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@ Add some **general info** about {{ replace .Name "-" " " | title }} here.

The site is built by:

* [Person 1](https://example.com)
* [Person 1](https://example.com)

* [Person 1](https://example.org)
* [Person 1](https://example.org)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/examples/zion-national-park.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/logos/logo-128x128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/logos/logo-256x256.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/logos/logo-512x512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/logos/logo-64x64.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/logos/logo-96x96.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions config/_default/menus/menus.en.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@
identifier = "functions"
url = "/functions/"

[[docs]]
name = "Methods"
weight = 75
identifier = "methods"
url = "/methods/"

[[docs]]
name = "Variables"
weight = 80
Expand Down
3 changes: 3 additions & 0 deletions config/_default/params.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@ images = ["images/gohugoio-card.png"]
flex_box_interior_classes = "flex-auto w-100 w-40-l mr3 mb3 bg-white ba b--moon-gray nested-copy-line-height"

#sidebar_direction = "sidebar_left"

[render_hooks.link]
errorLevel = 'warning' # ignore (default), warning, or error (fails the build)
4 changes: 2 additions & 2 deletions content/en/about/hugo-and-gdpr.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ simple

**Note:** If you use the _simple mode_ for Instagram and a site styled with Bootstrap 4, you may want to disable the inline styles provided by Hugo:

{{< code-toggle file="hugo" >}}
{{< code-toggle file="hugo" >}}
[services]
[services.instagram]
disableInlineCSS = true
Expand All @@ -114,7 +114,7 @@ simple

**Note:** If you use the _simple mode_ for Twitter, you may want to disable the inline styles provided by Hugo:

{{< code-toggle file="hugo" >}}
{{< code-toggle file="hugo" >}}
[services]
[services.twitter]
disableInlineCSS = true
Expand Down
19 changes: 9 additions & 10 deletions content/en/content-management/archetypes.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ draft = true

When you create new content, Hugo evaluates the [template actions] within the archetype. For example:

```text
```sh
hugo new content posts/my-first-post.md
```

Expand All @@ -53,7 +53,7 @@ Hugo looks for archetypes in the `archetypes` directory in the root of your proj

For example, with this command:

```text
```sh
hugo new content posts/my-first-post.md
```

Expand Down Expand Up @@ -85,7 +85,6 @@ Although typically used as a front matter template, you can also use an archetyp

For example, in a documentation site you might have a section (content type) for functions. Every page within this section should follow the same format: a brief description, the function signature, examples, and notes. We can pre-populate the page to remind content authors of the standard format.


{{< code file="archetypes/functions.md" copy=false >}}
---
date: '{{ .Date }}'
Expand Down Expand Up @@ -125,17 +124,17 @@ Create an archetype for galleries:
```text
archetypes/
├── galleries/
   ├── images/
   │   └── .gitkeep
   └── index.md <-- same format as default.md
├── images/
└── .gitkeep
└── index.md <-- same format as default.md
└── default.md
```

Subdirectories within an archetype must contain at least one file. Without a file, Hugo will not create the subdirectory when you create new content. The name and size of the file are irrelevant. The example above includes a&nbsp;`.gitkeep` file, an empty file commonly used to preserve otherwise empty directories in a Git repository.


To create a new gallery:
```text

```sh
hugo new galleries/bryce-canyon
```

Expand Down Expand Up @@ -166,13 +165,13 @@ archetypes/

To create an article using the articles archetype:

```text
```sh
hugo new content articles/something.md
```

To create an article using the tutorials archetype:

```text
```sh
hugo new content --kind tutorials articles/something.md
```

Expand Down
2 changes: 1 addition & 1 deletion content/en/content-management/build-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ If set to `true` (default) the [Bundle's Resources](/content-management/page-bun
Setting this to `false` will still publish Resources on demand (when a resource's `.Permalink` or `.RelPermalink` is invoked from the templates) but will skip the others.

{{% note %}}
Any page, regardless of their build options, will always be available using the [`.GetPage`](/functions/getpage) methods.
Any page, regardless of their build options, will always be available using the [`.GetPage`](/methods/page/getpage) methods.
{{% /note %}}

### Illustrative use cases
Expand Down
4 changes: 1 addition & 3 deletions content/en/content-management/cross-references.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ The `ref` and `relref` shortcodes require a single parameter: the path to a cont

The pages can be referenced as follows:


```text
{{</* ref "document2" */>}} // <- From pages/document1.md, relative path
{{</* ref "document2#anchor" */>}}
Expand Down Expand Up @@ -138,15 +137,14 @@ produces this HTML:

## Ref and RelRef Configuration

The behavior can, since Hugo 0.45, be configured in `hugo.toml`:
The behavior can be configured in `hugo.toml`:

refLinksErrorLevel ("ERROR")
: When using `ref` or `relref` to resolve page links and a link cannot resolved, it will be logged with this log level. Valid values are `ERROR` (default) or `WARNING`. Any `ERROR` will fail the build (`exit -1`).

refLinksNotFoundURL
: URL to be used as a placeholder when a page reference cannot be found in `ref` or `relref`. Is used as-is.


[lists]: /templates/lists/
[output formats]: /templates/output-formats/
[shortcode]: /content-management/shortcodes/
3 changes: 0 additions & 3 deletions content/en/content-management/diagrams.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,6 @@ Created from <https://arthursonzogni.com/Diagon/#Tree>
└─Fedora
```


### Sequence diagram

<https://arthursonzogni.com/Diagon/#Sequence>
Expand All @@ -186,7 +185,6 @@ Created from <https://arthursonzogni.com/Diagon/#Tree>
```


### Flowchart

<https://arthursonzogni.com/Diagon/#Flowchart>
Expand Down Expand Up @@ -232,7 +230,6 @@ Created from <https://arthursonzogni.com/Diagon/#Tree>
```


### Table

<https://arthursonzogni.com/Diagon/#Table>
Expand Down
2 changes: 1 addition & 1 deletion content/en/content-management/formats.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ The current list of content formats in Hugo:

| Name | Markup identifiers | Comment |
| ------------- | ------------- |-------------|
| Goldmark | md, markdown, goldmark |Note that you can set the default handler of `md` and `markdown` to something else, see [Configure Markup](/getting-started/configuration-markup/).|
| Goldmark | markdown, goldmark |Note that you can set the default handler of `md` and `markdown` to something else, see [Configure Markup](/getting-started/configuration-markup/).|
|Emacs Org-Mode|org|See [go-org](https://github.com/niklasfasching/go-org).|
|AsciiDoc|asciidocext, adoc, ad|Needs [Asciidoctor][ascii] installed.|
|RST|rst|Needs [RST](https://docutils.sourceforge.io/rst.html) installed.|
Expand Down
35 changes: 16 additions & 19 deletions content/en/content-management/image-processing/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ menu:
toc: true
weight: 90
---

## Image resources

To process an image you must access the file as a page resource, global resource, or remote resource.
Expand Down Expand Up @@ -50,7 +51,7 @@ To access an image as a global resource:

### Remote resource

A remote resource is a file on a remote server, accessible via http or https. To access an image as a remote resource:
A remote resource is a file on a remote server, accessible via HTTP or HTTPS. To access an image as a remote resource:

```go-html-template
{{ $image := resources.GetRemote "https://gohugo.io/img/hugo-logo.png" }}
Expand Down Expand Up @@ -112,7 +113,7 @@ Metadata (EXIF, IPTC, XMP, etc.) is not preserved during image transformation. U
{{< new-in "0.119.0" >}}

{{% note %}}
The `Process` method is also available as a filter, which is more effective if need to apply multiple filters to an image. See [Process filter](/functions/images/#process).
The `Process` method is also available as a filter, which is more effective if need to apply multiple filters to an image. See [Process filter](/functions/images/process).
{{% /note %}}

Process processes the image with the given specification. The specification can contain an optional action, one of `resize`, `crop`, `fit` or `fill`. This means that you can use this method instead of [`Resize`], [`Fit`], [`Fill`], or [`Crop`].
Expand All @@ -139,7 +140,6 @@ Some more examples:
{{ $image := $image.Process "fill 600x400" }}
```


### Resize

Resize an image to the specified width and/or height.
Expand Down Expand Up @@ -215,7 +215,6 @@ Sometimes it can be useful to create the filter chain once and then reuse it.

This method is fast, but if you also scale down your images, it would be good for performance to extract the colors from the scaled down image.


### EXIF

Provides an [EXIF] object containing image metadata.
Expand Down Expand Up @@ -266,7 +265,7 @@ You may also access EXIF fields individually, using the [`lang.FormatNumber`] fu

## Image processing options

The [`Resize`], [`Fit`], [`Fill`], and [`Crop`] methods accept a space-separated, case-insensitive list of options. The order of the options within the list is irrelevant.
The [`Resize`], [`Fit`], [`Fill`], and [`Crop`] methods accept a space-delimited, case-insensitive list of options. The order of the options within the list is irrelevant.

### Dimensions

Expand Down Expand Up @@ -369,7 +368,7 @@ The default value is `photo`. You may override the default value in the [site co

When converting an image from a format that supports transparency (e.g., PNG) to a format that does _not_ support transparency (e.g., JPEG), you may specify the background color of the resulting image.

Use either a 3-digit or a 6-digit hexadecimal color code (e.g., `#00f` or `#0000ff`).
Use either a 3-digit or 6-digit hexadecimal color code (e.g., `#00f` or `#0000ff`).

The default value is `#ffffff` (white). You may override the default value in the [site configuration].

Expand Down Expand Up @@ -402,28 +401,26 @@ See [github.com/disintegration/imaging] for the complete list of resampling filt

_The photo of the sunset used in the examples below is Copyright [Bjørn Erik Pedersen](https://commons.wikimedia.org/wiki/User:Bep) (Creative Commons Attribution-Share Alike 4.0 International license)_

{{< imgproc sunset Resize "300x" />}}
{{< imgproc "sunset.jpg" "resize 300x" />}}

{{< imgproc sunset Fill "90x120 left" />}}
{{< imgproc "sunset.jpg" "fill 90x120 left" />}}

{{< imgproc sunset Fill "90x120 right" />}}
{{< imgproc "sunset.jpg" "fill 90x120 right" />}}

{{< imgproc sunset Fit "90x90" />}}
{{< imgproc "sunset.jpg" "fit 90x90" />}}

{{< imgproc sunset Crop "250x250 center" />}}
{{< imgproc "sunset.jpg" "crop 250x250 center" />}}

{{< imgproc sunset Resize "300x q10" />}}
{{< imgproc "sunset.jpg" "resize 300x q10" />}}

This is the shortcode used to generate the examples above:

{{< code file="layouts/shortcodes/imgproc.html" >}}
{{< readfile file="layouts/shortcodes/imgproc.html" >}}
{{< /code >}}
{{< readfile file="layouts/shortcodes/imgproc.html" highlight="go-html-template" >}}

Call the shortcode from your Markdown like this:

```go-html-template
{{</* imgproc sunset Resize "300x" /*/>}}
{{</* imgproc "sunset.jpg" "resize 300x" /*/>}}
```

{{% note %}}
Expand Down Expand Up @@ -487,17 +484,17 @@ By default, Hugo uses the [Smartcrop] library when cropping images with the `Cro

Examples using the sunset image from above:

{{< imgproc sunset Fill "200x200 smart" />}}
{{< imgproc "sunset.jpg" "fill 200x200 smart" />}}

{{< imgproc sunset Crop "200x200 smart" />}}
{{< imgproc "sunset.jpg" "crop 200x200 smart" />}}

## Image processing performance consideration

Hugo caches processed images in the `resources` directory. If you include this directory in source control, Hugo will not have to regenerate the images in a CI/CD workflow (e.g., GitHub Pages, GitLab Pages, Netlify, etc.). This results in faster builds.

If you change image processing methods or options, or if you rename or remove images, the `resources` directory will contain unused images. To remove the unused images, perform garbage collection with:

```bash
```sh
hugo --gc
```

Expand Down
1 change: 0 additions & 1 deletion content/en/content-management/menus.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ class = 'center'

Access the entry with `site.Menus.main` in your templates. See [menu templates] for details.


## Define in site configuration

To define entries for the "main" menu:
Expand Down
Loading

0 comments on commit 1b8184a

Please sign in to comment.