Skip to content

Commit

Permalink
Consistently use file name instead of filename
Browse files Browse the repository at this point in the history
  • Loading branch information
jmooring committed Jul 9, 2023
1 parent 763dd64 commit 0506717
Show file tree
Hide file tree
Showing 19 changed files with 31 additions and 31 deletions.
2 changes: 1 addition & 1 deletion content/en/content-management/front-matter.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ weight
: Field name of the *plural* form of the index. See `tags` and `categories` in the above front matter examples. *Note that the plural form of user-defined taxonomies cannot be the same as any of the predefined front matter variables.*

{{% note %}}
If neither `slug` nor `url` is present and [permalinks are not configured otherwise in your site configuration file](/content-management/urls/#permalinks), Hugo will use the filename of your content to create the output URL. See [Content Organization](/content-management/organization) for an explanation of paths in Hugo and [URL Management](/content-management/urls/) for ways to customize Hugo's default behaviors.
If neither `slug` nor `url` is present and [permalinks are not configured otherwise in your site configuration file](/content-management/urls/#permalinks), Hugo will use the file name of your content to create the output URL. See [Content Organization](/content-management/organization) for an explanation of paths in Hugo and [URL Management](/content-management/urls/) for ways to customize Hugo's default behaviors.
{{% /note %}}

### User-Defined
Expand Down
12 changes: 6 additions & 6 deletions content/en/content-management/multilingual.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ subtitle = 'Reference, Tutorials, and Explanations'
[built-in RSS template]: https://github.com/gohugoio/hugo/blob/master/tpl/tplimpl/embedded/templates/_default/rss.xml
[built-in alias template]: https://github.com/gohugoio/hugo/blob/master/tpl/tplimpl/embedded/templates/alias.html
[RFC 5646]: https://datatracker.ietf.org/doc/html/rfc5646
[translating by file name]: #translation-by-filename
[translating by file name]: #translation-by-file-name

### Changes in Hugo 0.112.0

Expand Down Expand Up @@ -195,7 +195,7 @@ Live reload and `--navigateToChanged` between the servers work as expected.

There are two ways to manage your content translations. Both ensure each page is assigned a language and is linked to its counterpart translations.

### Translation by filename
### Translation by file name

Considering the following example:

Expand All @@ -205,9 +205,9 @@ Considering the following example:
The first file is assigned the English language and is linked to the second.
The second file is assigned the French language and is linked to the first.

Their language is __assigned__ according to the language code added as a __suffix to the filename__.
Their language is __assigned__ according to the language code added as a __suffix to the file name__.

By having the same **path and base filename**, the content pieces are __linked__ together as translated pages.
By having the same **path and base file name**, the content pieces are __linked__ together as translated pages.

{{% note %}}
If a file has no language code, it will be assigned the default language.
Expand Down Expand Up @@ -261,7 +261,7 @@ By setting the `translationKey` front matter param to `about` in all three pages

### Localizing permalinks

Because paths and filenames are used to handle linking, all translated pages will share the same URL (apart from the language subdirectory).
Because paths and file names are used to handle linking, all translated pages will share the same URL (apart from the language subdirectory).

To localize URLs:

Expand Down Expand Up @@ -292,7 +292,7 @@ If, across the linked bundles, two or more files share the same basename, only o
* First file found across bundles by order of language `Weight`.

{{% note %}}
Page Bundle resources follow the same language assignment logic as content files, both by filename (`image.jpg`, `image.fr.jpg`) and by directory (`english/about/header.jpg`, `french/about/header.jpg`).
Page Bundle resources follow the same language assignment logic as content files, both by file name (`image.jpg`, `image.fr.jpg`) and by directory (`english/about/header.jpg`, `french/about/header.jpg`).
{{%/ note %}}

## Reference the Translated Content
Expand Down
2 changes: 1 addition & 1 deletion content/en/content-management/page-bundles.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ A Page Bundle can be one of:
| | Leaf Bundle | Branch Bundle |
|-------------------------------------|----------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Usage | Collection of content and attachments for single pages | Collection of attachments for section pages (home page, section, taxonomy terms, taxonomy list) |
| Index filename | `index.md` [^fn:1] | `_index.md` [^fn:1] |
| Index file name | `index.md` [^fn:1] | `_index.md` [^fn:1] |
| Allowed Resources | Page and non-page (like images, PDF, etc.) types | Only non-page (like images, PDF, etc.) types |
| Where can the Resources live? | At any directory level within the leaf bundle directory. | Only in the directory level **of** the branch bundle directory i.e. the directory containing the `_index.md` ([ref](https://discourse.gohugo.io/t/question-about-content-folder-structure/11822/4?u=kaushalmodi)). |
| Layout type | [`single`](/templates/single-page-templates/) | [`list`](/templates/lists) |
Expand Down
2 changes: 1 addition & 1 deletion content/en/content-management/page-resources.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ ResourceType
: The main type of the resource's [Media Type](/templates/output-formats/#media-types). For example, a file of MIME type `image/jpeg` has the ResourceType `image`. A `Page` will have `ResourceType` with value `page`.

Name
: Default value is the filename (relative to the owning page). Can be set in front matter.
: Default value is the file name (relative to the owning page). Can be set in front matter.

Title
: Default value is the same as `.Name`. Can be set in front matter.
Expand Down
4 changes: 2 additions & 2 deletions content/en/content-management/urls.md
Original file line number Diff line number Diff line change
Expand Up @@ -271,10 +271,10 @@ Use these tokens when defining the URL pattern. The `date` field in front matter
: the content's slug (or title if no slug is provided in the front matter)

`:slugorfilename`
: the content's slug (or filename if no slug is provided in the front matter)
: the content's slug (or file name if no slug is provided in the front matter)

`:filename`
: the content's filename (without extension)
: the content's file name (without extension)

For time-related values, you can also use the layout string components defined in Go's [time package]. For example:

Expand Down
2 changes: 1 addition & 1 deletion content/en/functions/GetPage.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ And since `Page` also provides a `.GetPage` method, the above is the same as:

## .GetPage and Multilingual Sites

The previous examples have used the full content filename to look up the post. Depending on how you have organized your content (whether you have the language code in the file name or not, e.g. `my-post.en.md`), you may want to do the lookup without extension. This will get you the current language's version of the page:
The previous examples have used the full content file name to look up the post. Depending on how you have organized your content (whether you have the language code in the file name or not, e.g. `my-post.en.md`), you may want to do the lookup without extension. This will get you the current language's version of the page:

```go-html-template
{{ with .Site.GetPage "/blog/my-post" }}{{ .Title }}{{ end }}
Expand Down
2 changes: 1 addition & 1 deletion content/en/functions/readdir.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: readDir
description: Returns an array of FileInfo structures sorted by filename, one element for each directory entry.
description: Returns an array of FileInfo structures sorted by file name, one element for each directory entry.
categories: [functions]
menu:
docs:
Expand Down
6 changes: 3 additions & 3 deletions content/en/getting-started/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Multiple site config files can be specified as a comma-separated string to the `

## hugo.toml vs config.toml

In Hugo 0.110.0 we changed the default config base filename to `hugo`, e.g. `hugo.toml`. We will still look for `config.toml` etc., but we recommend you eventually rename it (but you need to wait if you want to support older Hugo versions). The main reason we're doing this is to make it easier for code editors and build tools to identify this as a Hugo configuration file and project.
In Hugo 0.110.0 we changed the default config base file name to `hugo`, e.g. `hugo.toml`. We will still look for `config.toml` etc., but we recommend you eventually rename it (but you need to wait if you want to support older Hugo versions). The main reason we're doing this is to make it easier for code editors and build tools to identify this as a Hugo configuration file and project.

{{< new-in "0.110.0" >}}

Expand Down Expand Up @@ -777,7 +777,7 @@ The above will try first to extract the value for `.Lastmod` starting with the `


`:filename`
: Fetches the date from the content file's filename. For example, `2018-02-22-mypage.md` will extract the date `2018-02-22`. Also, if `slug` is not set, `mypage` will be used as the value for `.Slug`.
: Fetches the date from the content file's file name. For example, `2018-02-22-mypage.md` will extract the date `2018-02-22`. Also, if `slug` is not set, `mypage` will be used as the value for `.Slug`.

An example:

Expand All @@ -786,7 +786,7 @@ An example:
date = [":filename", ":default"]
{{< /code-toggle >}}

The above will try first to extract the value for `.Date` from the filename, then it will look in front matter parameters `date`, `publishDate` and lastly `lastmod`.
The above will try first to extract the value for `.Date` from the file name, then it will look in front matter parameters `date`, `publishDate` and lastly `lastmod`.


`:git`
Expand Down
2 changes: 1 addition & 1 deletion content/en/getting-started/directory-structure.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ The following is a high-level overview of each of the directories with links to

[`archetypes`](/content-management/archetypes/)
: You can create new content files in Hugo using the `hugo new` command.
By default, Hugo will create new content files with at least `date`, `title` (inferred from the filename), and `draft = true`. This saves time and promotes consistency for sites using multiple content types. You can create your own [archetypes] with custom preconfigured front matter fields as well.
By default, Hugo will create new content files with at least `date`, `title` (inferred from the file name), and `draft = true`. This saves time and promotes consistency for sites using multiple content types. You can create your own [archetypes] with custom preconfigured front matter fields as well.

[`assets`]
: Stores all the files which need be processed by [Hugo Pipes](/hugo-pipes/). Only the files whose `.Permalink` or `.RelPermalink` are used will be published to the `public` directory.
Expand Down
4 changes: 2 additions & 2 deletions content/en/hugo-modules/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ private
: Comma separated glob list matching paths that should be treated as private.

workspace
: The workspace file to use. This enables Go workspace mode. Note that this can also be set via OS env, e.g. `export HUGO_MODULE_WORKSPACE=/my/hugo.work` This only works with Go 1.18+. In Hugo `v0.109.0` we changed the default to `off` and we now resolve any relative work filenames relative to the working directory.
: The workspace file to use. This enables Go workspace mode. Note that this can also be set via OS env, e.g. `export HUGO_MODULE_WORKSPACE=/my/hugo.work` This only works with Go 1.18+. In Hugo `v0.109.0` we changed the default to `off` and we now resolve any relative work file names relative to the working directory.

replacements
: A comma-separated list of mappings from module paths to directories, e.g. `github.com/bep/my-theme -> ../..,github.com/bep/shortcodes -> /some/path`. This is mostly useful for temporary local development of a module, in which case you might want to save it as an environment variable, e.g: `env HUGO_MODULE_REPLACEMENTS="github.com/bep/my-theme -> ../.."`. Relative paths are relative to [themesDir](https://gohugo.io/getting-started/configuration/#all-configuration-settings). Absolute paths are allowed.
Expand Down Expand Up @@ -157,7 +157,7 @@ lang
includeFiles (string or slice)
: One or more [glob](https://github.com/gobwas/glob) patterns matching files or directories to include. If `excludeFiles` is not set, the files matching `includeFiles` will be the files mounted.

The glob patterns are matched to the filenames starting from the `source` root, they should have Unix styled slashes even on Windows, `/` matches the mount root and `**` can be used as a super-asterisk to match recursively down all directories, e.g `/posts/**.jpg`.
The glob patterns are matched to the file names starting from the `source` root, they should have Unix styled slashes even on Windows, `/` matches the mount root and `**` can be used as a super-asterisk to match recursively down all directories, e.g `/posts/**.jpg`.

The search is case-insensitive.

Expand Down
2 changes: 1 addition & 1 deletion content/en/hugo-pipes/babel.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ verbose [bool]
: Log everything

sourceMap [string]
: Output `inline` or `external` sourcemap from the babel compile. External sourcemaps will be written to the target with the output filename + ".map". Input sourcemaps can be read from js.Build and node modules and combined into the output sourcemaps.
: Output `inline` or `external` sourcemap from the babel compile. External sourcemaps will be written to the target with the output file name + ".map". Input sourcemaps can be read from js.Build and node modules and combined into the output sourcemaps.


### Examples
Expand Down
2 changes: 1 addition & 1 deletion content/en/hugo-pipes/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Note that you can mount any directory into Hugo's virtual `assets` folder using

| Function | Description |
| ------------- | ------------- |
| `resources.Get` | Get locates the filename given in Hugo's assets filesystem and creates a `Resource` object that can be used for further transformations. See [Get Resource with resources.Get and resources.GetRemote](#get-resource-with-resourcesget-and-resourcesgetremote). |
| `resources.Get` | Get locates the file name given in Hugo's assets filesystem and creates a `Resource` object that can be used for further transformations. See [Get Resource with resources.Get and resources.GetRemote](#get-resource-with-resourcesget-and-resourcesgetremote). |
| `resources.GetRemote` | Same as `Get`, but it accepts remote URLs. See [Get Resource with resources.Get and resources.GetRemote](#get-resource-with-resourcesget-and-resourcesgetremote).|
| `resources.GetMatch` | `GetMatch` finds the first Resource matching the given pattern, or nil if none found. See Match for a more complete explanation about the rules used. |
| `resources.Match` | `Match` gets all resources matching the given base path prefix, e.g "*.png" will match all png files. The "*" does not match path delimiters (/), so if you organize your resources in sub-folders, you need to be explicit about it, e.g.: "images/*.png". To match any PNG image anywhere in the bundle you can do "\*\*.png", and to match all PNG images below the images folder, use "images/\*\*.jpg". The matching is case insensitive. Match matches by using the files name with path relative to the file system root with Unix style slashes (/) and no leading slash, e.g. "images/logo.png". See https://github.com/gobwas/glob for the full rules set.|
Expand Down
2 changes: 1 addition & 1 deletion content/en/hugo-pipes/js.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ format [string]
Default is `iife`, a self-executing function, suitable for inclusion as a <script> tag.

sourceMap [string]
: Whether to generate `inline` or `external` source maps from esbuild. External source maps will be written to the target with the output filename + ".map". Input source maps can be read from js.Build and node modules and combined into the output source maps. By default, source maps are not created.
: Whether to generate `inline` or `external` source maps from esbuild. External source maps will be written to the target with the output file name + ".map". Input source maps can be read from js.Build and node modules and combined into the output source maps. By default, source maps are not created.

### Import JS code from /assets

Expand Down
6 changes: 3 additions & 3 deletions content/en/templates/data-templates.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ In both cases, it's a good idea to outsource the data in their (own) files.

These files must be YAML, JSON, XML, or TOML files (using the `.yml`, `.yaml`, `.json`, `.xml`, or `.toml` extension). The data will be accessible as a `map` in the `.Site.Data` variable.

To access the data using the `site.Data.filename` notation, the filename must begin with an underscore or a Unicode letter, followed by zero or more underscores, Unicode letters, or Unicode digits. For example:
To access the data using the `site.Data.filename` notation, the file name must begin with an underscore or a Unicode letter, followed by zero or more underscores, Unicode letters, or Unicode digits. For example:

- `123.json` - Invalid
- `x123.json` - Valid
- `_123.json` - Valid

To access the data using the [`index`](/functions/index-function/) function, the filename is irrelevant. For example:
To access the data using the [`index`](/functions/index-function/) function, the file name is irrelevant. For example:

Data file|Template code
:--|:--
Expand Down Expand Up @@ -89,7 +89,7 @@ discography = [
]
{{< /code-toggle >}}

The list of bass players can be accessed via `.Site.Data.jazz.bass`, a single bass player by adding the filename without the suffix, e.g. `.Site.Data.jazz.bass.jacopastorius`.
The list of bass players can be accessed via `.Site.Data.jazz.bass`, a single bass player by adding the file name without the suffix, e.g. `.Site.Data.jazz.bass.jacopastorius`.

You can now render the list of recordings for all the bass players in a template:

Expand Down
2 changes: 1 addition & 1 deletion content/en/templates/internal.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ tags = []

Hugo uses the page title and description for the title and description metadata.
The first 6 URLs from the `images` array are used for image metadata.
If [page bundles](/content-management/page-bundles/) are used and the `images` array is empty or undefined, images with filenames matching `*feature*` or `*cover*,*thumbnail*` are used for image metadata.
If [page bundles](/content-management/page-bundles/) are used and the `images` array is empty or undefined, images with file names matching `*feature*` or `*cover*,*thumbnail*` are used for image metadata.

Various optional metadata can also be set:

Expand Down
4 changes: 2 additions & 2 deletions content/en/templates/output-formats.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ This is the full set of built-in media types in Hugo:
**Note:**

- It is possible to add custom media types or change the defaults; e.g., if you want to change the suffix for `text/html` to `asp`.
- `Suffixes` are the values that will be used for URLs and filenames for that media type in Hugo.
- `Suffixes` are the values that will be used for URLs and file names for that media type in Hugo.
- The `Type` is the identifier that must be used when defining new/custom `Output Formats` (see below).
- The full set of media types will be registered in Hugo's built-in development server to make sure they are recognized by the browser.

Expand Down Expand Up @@ -94,7 +94,7 @@ The following is the full list of configuration options for output formats and t
: sub path to save the output files.

`baseName`
: the base filename for the list filenames (homepage, etc.). **Default:** `index`.
: the base file name for the list file names (homepage, etc.). **Default:** `index`.

`rel`
: can be used to create `rel` values in `link` tags. **Default:** `alternate`.
Expand Down
Loading

0 comments on commit 0506717

Please sign in to comment.