mirror of
https://github.com/gohugoio/hugo.git
synced 2026-08-26 08:18:53 +00:00
Compare commits
141 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e08ce30fe4 | |||
| a99fed4852 | |||
| db945a6ed2 | |||
| bafb389b38 | |||
| 0a019a1a59 | |||
| 9f7fb0a73b | |||
| f04cc581e1 | |||
| 00c4484c70 | |||
| cdd83bf3c8 | |||
| e00220a06a | |||
| a662ddae13 | |||
| 13adf3e028 | |||
| fe08d35f24 | |||
| 4b675ddd4a | |||
| 24eaa290cf | |||
| f6ab9553f4 | |||
| 58a98c7758 | |||
| 900904fd11 | |||
| 24eca0cbe9 | |||
| 60e0e2c1d9 | |||
| 52ea07d2eb | |||
| 77fc74a5b2 | |||
| 0e3b42b4a9 | |||
| f50585442d | |||
| 2aedccc9a9 | |||
| c10931404f | |||
| 4732c47d1d | |||
| 62780ec8dd | |||
| 351d6b062b | |||
| 631d768be9 | |||
| e5d2a8f6a3 | |||
| 00ff161b67 | |||
| 588710a7ac | |||
| ed930db2f0 | |||
| 05df964816 | |||
| 20ef6dcf95 | |||
| 9860e0e186 | |||
| d1cd1db0e7 | |||
| 09e10110a3 | |||
| 2ef60dbd2d | |||
| 6275aad9e2 | |||
| 01ebb6e304 | |||
| a066e98851 | |||
| 1fd3320dcf | |||
| 0fb2b3d143 | |||
| db05232d56 | |||
| 2734f956c3 | |||
| 58b8245813 | |||
| ec57cf2c30 | |||
| 3a9cb7b0fb | |||
| 0addb302ac | |||
| b002d47953 | |||
| e3f31352d4 | |||
| ec02c537ed | |||
| 84cbe72498 | |||
| 4611b6920b | |||
| 2171e3c9a5 | |||
| cac773aeff | |||
| 51010a69bc | |||
| 8958b8741f | |||
| 29ccb36069 | |||
| d8aba18e05 | |||
| c744dbd6ed | |||
| 5c41653364 | |||
| 281554ee97 | |||
| f3560aa0e1 | |||
| edf9038a92 | |||
| 78f49b4c0d | |||
| fa4b77e7ed | |||
| 8377c3cea1 | |||
| 4d909d4768 | |||
| 4eb6d97404 | |||
| 4f9cb4f344 | |||
| 0171fb2010 | |||
| a4028112e3 | |||
| 08f0984f91 | |||
| 86653fa38e | |||
| c46d104985 | |||
| b665f1e8f1 | |||
| 6be6752c8a | |||
| 8e9dce1092 | |||
| 00b71668b2 | |||
| beebf2afb0 | |||
| 3f0b40f674 | |||
| 0bd79d30c1 | |||
| 8e77bcc930 | |||
| 74daca6b30 | |||
| 1fd4c562af | |||
| a5cda5ca4d | |||
| 5e2b28d6e6 | |||
| f2019f0a23 | |||
| 475638fe02 | |||
| 203cc54578 | |||
| 90ad804505 | |||
| af23cdca9c | |||
| ab5ce59894 | |||
| 7d40da876c | |||
| 02c89a446d | |||
| 06c3ac6741 | |||
| 5e03de0ddb | |||
| bef31b58aa | |||
| b76146b129 | |||
| 8e5044d7f5 | |||
| 5046a6c7ca | |||
| 160a067c81 | |||
| e0ba1a805a | |||
| 7b49c56a6a | |||
| dffca57883 | |||
| 79932e7225 | |||
| 9eb9b70a29 | |||
| 0ff4a9326f | |||
| 45e1084ff2 | |||
| c98348416c | |||
| 2de393c791 | |||
| 7efb35680f | |||
| ddbcc67122 | |||
| fd75f129b2 | |||
| 14878ca0a0 | |||
| e88873b803 | |||
| 4219993b0c | |||
| 988e1417a0 | |||
| 42529882ce | |||
| 45f1b1cfc5 | |||
| 369bdf22f8 | |||
| d1b03a093f | |||
| 941c28ab0c | |||
| ffbdcc75ab | |||
| 95d9764518 | |||
| b66f9f2665 | |||
| f7e00c039f | |||
| f5ba6fd45c | |||
| c4bbc1eeeb | |||
| 0e0fb1b648 | |||
| b017f7cb01 | |||
| 7fb28085ac | |||
| 0cd1929b9c | |||
| cbdaff2135 | |||
| 3fefea06b8 | |||
| 5c48ba9343 | |||
| 21562e3aad | |||
| 9c24b86e4b |
+96
-33
@@ -1,51 +1,114 @@
|
||||
defaults: &defaults
|
||||
docker:
|
||||
- image: bepsays/ci-goreleaser:1.1800.300
|
||||
environment:
|
||||
CGO_ENABLED: "0"
|
||||
parameters:
|
||||
|
||||
# v2: 11m.
|
||||
defaults: &defaults
|
||||
resource_class: large
|
||||
docker:
|
||||
- image: bepsays/ci-hugoreleaser:1.21900.20200
|
||||
environment: &buildenv
|
||||
GOMODCACHE: /root/project/gomodcache
|
||||
version: 2
|
||||
jobs:
|
||||
build:
|
||||
<<: *defaults
|
||||
prepare_release:
|
||||
<<: *defaults
|
||||
environment: &buildenv
|
||||
GOMODCACHE: /root/project/gomodcache
|
||||
steps:
|
||||
- checkout:
|
||||
- &remote-docker
|
||||
setup_remote_docker:
|
||||
version: 20.10.14
|
||||
- checkout:
|
||||
path: hugo
|
||||
- &git-config
|
||||
run:
|
||||
command: |
|
||||
git config --global user.email "bjorn.erik.pedersen+hugoreleaser@gmail.com"
|
||||
git config --global user.name "hugoreleaser"
|
||||
- run:
|
||||
command: |
|
||||
git clone git@github.com:gohugoio/hugoDocs.git
|
||||
cd hugo
|
||||
go mod download
|
||||
sleep 5
|
||||
go mod verify
|
||||
- persist_to_workspace:
|
||||
root: .
|
||||
paths: .
|
||||
release:
|
||||
<<: *defaults
|
||||
command: |
|
||||
cd hugo
|
||||
go mod download
|
||||
go run -tags release main.go release --step 1
|
||||
- save_cache:
|
||||
key: git-sha-{{ .Revision }}
|
||||
paths:
|
||||
- hugo
|
||||
- gomodcache
|
||||
build_container1:
|
||||
<<: [*defaults]
|
||||
environment:
|
||||
<<: [*buildenv]
|
||||
steps:
|
||||
- attach_workspace:
|
||||
at: /root/project
|
||||
- &restore-cache
|
||||
restore_cache:
|
||||
key: git-sha-{{ .Revision }}
|
||||
- run:
|
||||
command: |
|
||||
cd hugo
|
||||
git config --global user.email "bjorn.erik.pedersen+hugoreleaser@gmail.com"
|
||||
git config --global user.name "hugoreleaser"
|
||||
go run -tags release main.go release -r ${CIRCLE_BRANCH}
|
||||
|
||||
no_output_timeout: 20m
|
||||
command: |
|
||||
mkdir -p /tmp/files/dist1
|
||||
cd hugo
|
||||
hugoreleaser build -paths "builds/container1/**" -workers 3 -dist /tmp/files/dist1 -chunks $CIRCLE_NODE_TOTAL -chunk-index $CIRCLE_NODE_INDEX
|
||||
- &persist-workspace
|
||||
persist_to_workspace:
|
||||
root: /tmp/files
|
||||
paths:
|
||||
- dist1
|
||||
- dist2
|
||||
parallelism: 7
|
||||
build_container2:
|
||||
<<: [*defaults]
|
||||
environment:
|
||||
<<: [*buildenv]
|
||||
docker:
|
||||
- image: bepsays/ci-hugoreleaser-linux-arm64:1.21900.20200
|
||||
steps:
|
||||
- *restore-cache
|
||||
- &attach-workspace
|
||||
attach_workspace:
|
||||
at: /tmp/workspace
|
||||
- run:
|
||||
command: |
|
||||
mkdir -p /tmp/files/dist2
|
||||
cd hugo
|
||||
hugoreleaser build -paths "builds/container2/**" -workers 1 -dist /tmp/files/dist2
|
||||
- *persist-workspace
|
||||
archive_and_release:
|
||||
<<: [*defaults]
|
||||
environment:
|
||||
<<: [*buildenv]
|
||||
steps:
|
||||
- *restore-cache
|
||||
- *attach-workspace
|
||||
- *git-config
|
||||
- run:
|
||||
command: |
|
||||
cp -a /tmp/workspace/dist1/. ./hugo/dist
|
||||
cp -a /tmp/workspace/dist2/. ./hugo/dist
|
||||
- run:
|
||||
command: |
|
||||
cd hugo
|
||||
hugoreleaser archive
|
||||
hugoreleaser release
|
||||
go run -tags release main.go release --step 2
|
||||
workflows:
|
||||
version: 2
|
||||
release:
|
||||
jobs:
|
||||
- build:
|
||||
- prepare_release:
|
||||
filters:
|
||||
branches:
|
||||
only: /release-.*/
|
||||
- hold:
|
||||
type: approval
|
||||
- build_container1:
|
||||
requires:
|
||||
- build
|
||||
- release:
|
||||
- prepare_release
|
||||
- build_container2:
|
||||
requires:
|
||||
- prepare_release
|
||||
- archive_and_release:
|
||||
context: org-global
|
||||
requires:
|
||||
- hold
|
||||
- build_container1
|
||||
- build_container2
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -3,8 +3,13 @@ on:
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
- cron: '30 1 * * *'
|
||||
permissions:
|
||||
contents: read
|
||||
jobs:
|
||||
stale:
|
||||
permissions:
|
||||
issues: write
|
||||
pull-requests: write
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: dessant/lock-threads@08e671be8ac8944d0e132aa71d0ae8ccfb347675
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
on: [push, pull_request]
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
pull_request:
|
||||
name: Test
|
||||
permissions:
|
||||
contents: read
|
||||
@@ -13,14 +16,21 @@ jobs:
|
||||
# Go 1.18 had some breaking changes on the source level which means Hugo cannot be built
|
||||
# with older Go versions, but the improvements in Go 1.18 were too good to pass on (e.g. break and continue).
|
||||
# Note that you don't need Go (or Go 1.18) to run a pre-built binary.
|
||||
go-version: [1.18.x]
|
||||
go-version: [1.18.x,1.19.x]
|
||||
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
|
||||
- name: Install Go
|
||||
uses: actions/setup-go@37335c7bb261b353407cff977110895fa0b4f7d8
|
||||
uses: actions/setup-go@268d8c0ca0432bb2cf416faae41297df9d262d7f
|
||||
with:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
check-latest: true
|
||||
cache: true
|
||||
cache-dependency-path: |
|
||||
**/go.sum
|
||||
**/go.mod
|
||||
- name: Install Ruby
|
||||
uses: actions/setup-ruby@5f29a1cd8dfebf420691c4c9a0e832e2fae5a526
|
||||
with:
|
||||
@@ -33,8 +43,6 @@ jobs:
|
||||
run: go install github.com/magefile/mage@07afc7d24f4d6d6442305d49552f04fbda5ccb3e
|
||||
- name: Install asciidoctor
|
||||
uses: reitzig/actions-asciidoctor@7570212ae20b63653481675fb1ff62d1073632b0
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
|
||||
- name: Install docutils
|
||||
run: |
|
||||
pip install docutils
|
||||
@@ -49,9 +57,11 @@ jobs:
|
||||
brew install pandoc
|
||||
- if: matrix.os == 'windows-latest'
|
||||
run: |
|
||||
choco install pandoc
|
||||
choco install mingw --version 10.2.0 --allow-downgrade
|
||||
Choco-Install -PackageName pandoc
|
||||
- run: pandoc -v
|
||||
- if: matrix.os == 'windows-latest'
|
||||
run: |
|
||||
Choco-Install -PackageName mingw -ArgumentList "--version","10.2.0","--allow-downgrade"
|
||||
- if: matrix.os == 'ubuntu-latest'
|
||||
name: Install dart-sass-embedded Linux
|
||||
run: |
|
||||
|
||||
+2
-2
@@ -2,7 +2,7 @@
|
||||
# Twitter: https://twitter.com/gohugoio
|
||||
# Website: https://gohugo.io/
|
||||
|
||||
FROM golang:1.18-alpine AS build
|
||||
FROM golang:1.19-alpine AS build
|
||||
|
||||
# Optionally set HUGO_BUILD_TAGS to "extended" or "nodeploy" when building like so:
|
||||
# docker build --build-arg HUGO_BUILD_TAGS=extended .
|
||||
@@ -26,7 +26,7 @@ RUN mage hugo && mage install
|
||||
|
||||
# ---
|
||||
|
||||
FROM alpine:3.12
|
||||
FROM alpine:3.16
|
||||
|
||||
COPY --from=build /go/bin/hugo /usr/bin/hugo
|
||||
|
||||
|
||||
@@ -186,7 +186,7 @@
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
Copyright 2022 The Hugo Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<a href="https://gohugo.io/"><img src="https://raw.githubusercontent.com/gohugoio/gohugoioTheme/master/static/images/hugo-logo-wide.svg?sanitize=true" alt="Hugo" width="565"></a>
|
||||
|
||||
A Fast and Flexible Static Site Generator built with love by [bep](https://github.com/bep), [spf13](https://spf13.com/) and [friends](https://github.com/gohugoio/hugo/graphs/contributors) in [Go][].
|
||||
A Fast and Flexible Static Site Generator built with love by [bep](https://github.com/bep), [spf13](https://spf13.com/) and [friends](https://github.com/gohugoio/hugo/graphs/contributors) in [Go](https://go.dev/).
|
||||
|
||||
[Website](https://gohugo.io) |
|
||||
[Forum](https://discourse.gohugo.io) |
|
||||
@@ -13,9 +13,19 @@ A Fast and Flexible Static Site Generator built with love by [bep](https://githu
|
||||
[](https://github.com/gohugoio/hugo/actions?query=workflow%3ATest)
|
||||
[](https://goreportcard.com/report/github.com/gohugoio/hugo)
|
||||
|
||||
* [Overview](#overview)
|
||||
* [Banner Sponsors](#banner-sponsors)
|
||||
* [Supported Architectures](#supported-architectures)
|
||||
* [Choose How to Install](#choose-how-to-install)
|
||||
* [Install Hugo as Your Site Generator (Binary Install)](#install-hugo-as-your-site-generator-binary-install)
|
||||
* [Build and Install the Binary from Source (Using the Go toolchain)](#build-and-install-the-binary-from-source-using-the-go-toolchain)
|
||||
* [The Hugo Documentation](#the-hugo-documentation)
|
||||
* [Contributing to Hugo](#contributing-code-to-hugo)
|
||||
* [Dependencies](#dependencies)
|
||||
|
||||
## Overview
|
||||
|
||||
Hugo is a static HTML and CSS website generator written in [Go][].
|
||||
Hugo is a static HTML and CSS website generator written in [Go](https://go.dev/).
|
||||
It is optimized for speed, ease of use, and configurability.
|
||||
Hugo takes a directory with content and templates and renders them into a full HTML website.
|
||||
|
||||
@@ -27,7 +37,16 @@ A good rule of thumb is that each piece of content renders in around 1 milliseco
|
||||
|
||||
Hugo is designed to work well for any kind of website including blogs, tumbles, and docs.
|
||||
|
||||
#### Supported Architectures
|
||||
## Banner Sponsors
|
||||
<p> </p>
|
||||
<p float="left">
|
||||
<a href="https://www.linode.com/?utm_campaign=hugosponsor&utm_medium=banner&utm_source=hugogithub" target="_blank"><img src="https://raw.githubusercontent.com/gohugoio/gohugoioTheme/master/static/images/sponsors/linode-logo_standard_light_medium.png" width="200" alt="Linode"></a>
|
||||
<a href="https://esolia.com/post/why-did-esolia-choose-hugo/?utm_campaign=hugosponsor&utm_medium=banner&utm_source=hugogithub" target="_blank"><img src="https://raw.githubusercontent.com/gohugoio/gohugoioTheme/master/static/images/sponsors/esolia-logo.svg?sanitize=true" width="200" alt="eSOLIA"></a>
|
||||
<a href="https://buttercms.com/hugo-cms/?utm_campaign=sponsorship&utm_medium=banner&utm_source=hugogithub" target="_blank"><img src="https://raw.githubusercontent.com/gohugoio/gohugoioTheme/master/static/images/sponsors/butter-dark.svg?sanitize=true" width="280" alt="ButterCMS"></a>
|
||||
</p>
|
||||
<p> </p>
|
||||
|
||||
## Supported Architectures
|
||||
|
||||
Currently, we provide pre-built Hugo binaries for Windows, Linux, FreeBSD, NetBSD, DragonFly BSD, OpenBSD, macOS (Darwin), and [Android](https://gist.github.com/bep/a0d8a26cf6b4f8bc992729b8e50b480b) for x64, i386 and ARM architectures.
|
||||
|
||||
@@ -38,7 +57,6 @@ Hugo may also be compiled from source wherever the Go compiler tool chain can ru
|
||||
## Choose How to Install
|
||||
|
||||
If you want to use Hugo as your site generator, simply install the Hugo binaries.
|
||||
The Hugo binaries have no external dependencies.
|
||||
|
||||
To contribute to the Hugo source code or documentation, you should [fork the Hugo GitHub project](https://github.com/gohugoio/hugo#fork-destination-box) and clone it to your local machine.
|
||||
|
||||
@@ -49,31 +67,24 @@ Building the binaries is an easy task for an experienced `go` getter.
|
||||
|
||||
Use the [installation instructions in the Hugo documentation](https://gohugo.io/getting-started/installing/).
|
||||
|
||||
### Build and Install the Binaries from Source (Advanced Install)
|
||||
### Build and Install the Binary from Source (Using the Go toolchain)
|
||||
|
||||
#### Prerequisite Tools
|
||||
|
||||
* [Git](https://git-scm.com/)
|
||||
* [Go (we test it with the last 2 major versions; but note that Hugo 0.95.0 only builds with >= Go 1.18.)](https://golang.org/dl/)
|
||||
|
||||
#### Fetch from GitHub
|
||||
|
||||
To fetch and build the source from GitHub:
|
||||
To fetch, build and install from the Github source:
|
||||
|
||||
```bash
|
||||
mkdir $HOME/src
|
||||
cd $HOME/src
|
||||
git clone https://github.com/gohugoio/hugo.git
|
||||
cd hugo
|
||||
go install
|
||||
go install github.com/gohugoio/hugo@latest
|
||||
```
|
||||
|
||||
**If you are a Windows user, substitute the `$HOME` environment variable above with `%USERPROFILE%`.**
|
||||
|
||||
If you want to compile with Sass/SCSS support use `--tags extended` and make sure `CGO_ENABLED=1` is set in your go environment. If you don't want to have CGO enabled, you may use the following command to temporarily enable CGO only for hugo compilation:
|
||||
|
||||
```bash
|
||||
CGO_ENABLED=1 go install --tags extended
|
||||
CGO_ENABLED=1 go install --tags extended github.com/gohugoio/hugo@latest
|
||||
```
|
||||
|
||||
## The Hugo Documentation
|
||||
@@ -83,7 +94,7 @@ The Hugo documentation now lives in its own repository, see https://github.com/g
|
||||
```bash
|
||||
git clone git@github.com:gohugoio/hugo.git
|
||||
```
|
||||
## Contributing to Hugo
|
||||
## Contributing code to Hugo
|
||||
|
||||
**Note March 16th 2022:** We are currently very constrained on human resources to do code reviews, so we currently require any new Pull Requests to be limited to bug fixes closing an existing issue. Also, we have updated to Go 1.18, but we will currently not accept any generic rewrites, "interface{} to any" replacements and similar.
|
||||
|
||||
@@ -96,34 +107,18 @@ helping to manage issues, etc.
|
||||
|
||||
The Hugo community and maintainers are [very active](https://github.com/gohugoio/hugo/pulse/monthly) and helpful, and the project benefits greatly from this activity.
|
||||
|
||||
### Asking Support Questions
|
||||
## Asking Support Questions
|
||||
|
||||
We have an active [discussion forum](https://discourse.gohugo.io) where users and developers can ask questions.
|
||||
Please don't use the GitHub issue tracker to ask questions.
|
||||
|
||||
### Reporting Issues
|
||||
## Reporting Issues
|
||||
|
||||
If you believe you have found a defect in Hugo or its documentation, use
|
||||
the GitHub issue tracker to report the problem to the Hugo maintainers.
|
||||
If you're not sure if it's a bug or not, start by asking in the [discussion forum](https://discourse.gohugo.io).
|
||||
When reporting the issue, please provide the version of Hugo in use (`hugo version`).
|
||||
|
||||
### Submitting Patches
|
||||
|
||||
The Hugo project welcomes all contributors and contributions regardless of skill or experience level.
|
||||
If you are interested in helping with the project, we will help you with your contribution.
|
||||
Hugo is a very active project with many contributions happening daily.
|
||||
|
||||
We want to create the best possible product for our users and the best contribution experience for our developers,
|
||||
we have a set of guidelines which ensure that all contributions are acceptable.
|
||||
The guidelines are not intended as a filter or barrier to participation.
|
||||
If you are unfamiliar with the contribution process, the Hugo team will help you and teach you how to bring your contribution in accordance with the guidelines.
|
||||
|
||||
For a complete guide to contributing code to Hugo, see the [Contribution Guide](CONTRIBUTING.md).
|
||||
|
||||
[Go]: https://golang.org/
|
||||
[Hugo Documentation]: https://gohugo.io/overview/introduction/
|
||||
|
||||
## Dependencies
|
||||
|
||||
Hugo stands on the shoulder of many great open source libraries.
|
||||
@@ -245,4 +240,3 @@ google.golang.org/grpc="v1.46.0"
|
||||
google.golang.org/protobuf="v1.28.0"
|
||||
gopkg.in/yaml.v2="v2.4.0"
|
||||
```
|
||||
|
||||
|
||||
@@ -79,8 +79,8 @@ type commandeer struct {
|
||||
changeDetector *fileChangeDetector
|
||||
|
||||
// We need to reuse these on server rebuilds.
|
||||
// These 2 will be different if --renderStaticToDisk is set.
|
||||
publishDirFs afero.Fs
|
||||
publishDirStaticFs afero.Fs
|
||||
publishDirServerFs afero.Fs
|
||||
|
||||
h *hugoBuilderCommon
|
||||
@@ -170,6 +170,7 @@ func (c *commandeer) Set(key string, value any) {
|
||||
|
||||
func (c *commandeer) initFs(fs *hugofs.Fs) error {
|
||||
c.publishDirFs = fs.PublishDir
|
||||
c.publishDirStaticFs = fs.PublishDirStatic
|
||||
c.publishDirServerFs = fs.PublishDirServer
|
||||
c.DepsCfg.Fs = fs
|
||||
|
||||
@@ -426,6 +427,7 @@ func (c *commandeer) loadConfig() error {
|
||||
if c.publishDirFs != nil {
|
||||
// Need to reuse the destination on server rebuilds.
|
||||
fs.PublishDir = c.publishDirFs
|
||||
fs.PublishDirStatic = c.publishDirStaticFs
|
||||
fs.PublishDirServer = c.publishDirServerFs
|
||||
} else {
|
||||
if c.renderStaticToDisk {
|
||||
|
||||
@@ -47,7 +47,7 @@ func TestExecute(t *testing.T) {
|
||||
c.Assert(resp.Err, qt.IsNil)
|
||||
result := resp.Result
|
||||
c.Assert(len(result.Sites) == 1, qt.Equals, true)
|
||||
c.Assert(len(result.Sites[0].RegularPages()) == 1, qt.Equals, true)
|
||||
c.Assert(len(result.Sites[0].RegularPages()) == 2, qt.Equals, true)
|
||||
c.Assert(result.Sites[0].Info.Params()["myparam"], qt.Equals, "paramproduction")
|
||||
})
|
||||
|
||||
@@ -362,11 +362,25 @@ weight: 1
|
||||
|
||||
Content
|
||||
|
||||
`)
|
||||
|
||||
writeFile(t, filepath.Join(dir, contentDir, "hügö.md"), `
|
||||
---
|
||||
weight: 2
|
||||
---
|
||||
|
||||
This is hügö.
|
||||
|
||||
`)
|
||||
|
||||
writeFile(t, filepath.Join(dir, "layouts", "_default", "single.html"), `
|
||||
|
||||
Single: {{ .Title }}
|
||||
Single: {{ .Title }}|{{ .Content }}
|
||||
|
||||
`)
|
||||
|
||||
writeFile(t, filepath.Join(dir, "layouts", "404.html"), `
|
||||
404: {{ .Title }}|Not Found.
|
||||
|
||||
`)
|
||||
|
||||
|
||||
+9
-9
@@ -511,12 +511,15 @@ func (c *commandeer) build() error {
|
||||
c.hugo().PrintProcessingStats(os.Stdout)
|
||||
fmt.Println()
|
||||
|
||||
if createCounter, ok := c.publishDirFs.(hugofs.DuplicatesReporter); ok {
|
||||
dupes := createCounter.ReportDuplicates()
|
||||
if dupes != "" {
|
||||
c.logger.Warnln("Duplicate target paths:", dupes)
|
||||
hugofs.WalkFilesystems(c.publishDirFs, func(fs afero.Fs) bool {
|
||||
if dfs, ok := fs.(hugofs.DuplicatesReporter); ok {
|
||||
dupes := dfs.ReportDuplicates()
|
||||
if dupes != "" {
|
||||
c.logger.Warnln("Duplicate target paths:", dupes)
|
||||
}
|
||||
}
|
||||
}
|
||||
return false
|
||||
})
|
||||
|
||||
unusedTemplates := c.hugo().Tmpl().(tpl.UnusedTemplatesProvider).UnusedTemplates()
|
||||
for _, unusedTemplate := range unusedTemplates {
|
||||
@@ -650,10 +653,7 @@ func (c *commandeer) copyStaticTo(sourceFs *filesystems.SourceFilesystem) (uint6
|
||||
syncer.NoChmod = c.Cfg.GetBool("noChmod")
|
||||
syncer.ChmodFilter = chmodFilter
|
||||
syncer.SrcFs = fs
|
||||
syncer.DestFs = c.Fs.PublishDir
|
||||
if c.renderStaticToDisk {
|
||||
syncer.DestFs = c.Fs.PublishDirStatic
|
||||
}
|
||||
syncer.DestFs = c.Fs.PublishDirStatic
|
||||
// Now that we are using a unionFs for the static directories
|
||||
// We can effectively clean the publishDir on initial sync
|
||||
syncer.Delete = c.Cfg.GetBool("cleanDestinationDir")
|
||||
|
||||
+3
-1
@@ -32,6 +32,7 @@ var _ cmder = (*newCmd)(nil)
|
||||
type newCmd struct {
|
||||
contentEditor string
|
||||
contentType string
|
||||
force bool
|
||||
|
||||
*baseBuilderCmd
|
||||
}
|
||||
@@ -54,6 +55,7 @@ Ensure you run this within the root directory of your site.`,
|
||||
|
||||
cmd.Flags().StringVarP(&cc.contentType, "kind", "k", "", "content type to create")
|
||||
cmd.Flags().StringVar(&cc.contentEditor, "editor", "", "edit new content with this editor, if provided")
|
||||
cmd.Flags().BoolVarP(&cc.force, "force", "f", false, "overwrite file if it already exists")
|
||||
|
||||
cmd.AddCommand(b.newNewSiteCmd().getCommand())
|
||||
cmd.AddCommand(b.newNewThemeCmd().getCommand())
|
||||
@@ -80,7 +82,7 @@ func (n *newCmd) newContent(cmd *cobra.Command, args []string) error {
|
||||
return newUserError("path needs to be provided")
|
||||
}
|
||||
|
||||
return create.NewContent(c.hugo(), n.contentType, args[0])
|
||||
return create.NewContent(c.hugo(), n.contentType, args[0], n.force)
|
||||
}
|
||||
|
||||
func mkdir(x ...string) {
|
||||
|
||||
+11
-12
@@ -17,8 +17,6 @@
|
||||
package commands
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"github.com/gohugoio/hugo/config"
|
||||
"github.com/gohugoio/hugo/releaser"
|
||||
"github.com/spf13/cobra"
|
||||
@@ -29,10 +27,9 @@ var _ cmder = (*releaseCommandeer)(nil)
|
||||
type releaseCommandeer struct {
|
||||
cmd *cobra.Command
|
||||
|
||||
version string
|
||||
|
||||
skipPublish bool
|
||||
try bool
|
||||
step int
|
||||
skipPush bool
|
||||
try bool
|
||||
}
|
||||
|
||||
func createReleaser() cmder {
|
||||
@@ -50,9 +47,9 @@ func createReleaser() cmder {
|
||||
return r.release()
|
||||
}
|
||||
|
||||
r.cmd.PersistentFlags().StringVarP(&r.version, "rel", "r", "", "new release version, i.e. 0.25.1")
|
||||
r.cmd.PersistentFlags().BoolVarP(&r.skipPublish, "skip-publish", "", false, "skip all publishing pipes of the release")
|
||||
r.cmd.PersistentFlags().BoolVarP(&r.try, "try", "", false, "simulate a release, i.e. no changes")
|
||||
r.cmd.PersistentFlags().BoolVarP(&r.skipPush, "skip-push", "", false, "skip pushing to remote")
|
||||
r.cmd.PersistentFlags().BoolVarP(&r.try, "try", "", false, "no changes")
|
||||
r.cmd.PersistentFlags().IntVarP(&r.step, "step", "", 0, "step to run (1: set new version 2: prepare next dev version)")
|
||||
|
||||
return r
|
||||
}
|
||||
@@ -65,8 +62,10 @@ func (c *releaseCommandeer) flagsToConfig(cfg config.Provider) {
|
||||
}
|
||||
|
||||
func (r *releaseCommandeer) release() error {
|
||||
if r.version == "" {
|
||||
return errors.New("must set the --rel flag to the relevant version number")
|
||||
rel, err := releaser.New(r.skipPush, r.try, r.step)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return releaser.New(r.version, r.skipPublish, r.try).Run()
|
||||
|
||||
return rel.Run()
|
||||
}
|
||||
|
||||
+25
-5
@@ -400,24 +400,31 @@ func (f *fileServer) createEndpoint(i int) (*http.ServeMux, net.Listener, string
|
||||
}
|
||||
|
||||
// Ignore any query params for the operations below.
|
||||
requestURI := strings.TrimSuffix(r.RequestURI, "?"+r.URL.RawQuery)
|
||||
requestURI, _ := url.PathUnescape(strings.TrimSuffix(r.RequestURI, "?"+r.URL.RawQuery))
|
||||
|
||||
for _, header := range f.c.serverConfig.MatchHeaders(requestURI) {
|
||||
w.Header().Set(header.Key, header.Value)
|
||||
}
|
||||
|
||||
if redirect := f.c.serverConfig.MatchRedirect(requestURI); !redirect.IsZero() {
|
||||
// fullName := filepath.Join(dir, filepath.FromSlash(path.Clean("/"+name)))
|
||||
doRedirect := true
|
||||
// This matches Netlify's behaviour and is needed for SPA behaviour.
|
||||
// See https://docs.netlify.com/routing/redirects/rewrites-proxies/
|
||||
if !redirect.Force {
|
||||
path := filepath.Clean(strings.TrimPrefix(requestURI, u.Path))
|
||||
fi, err := f.c.hugo().BaseFs.PublishFs.Stat(path)
|
||||
if root != "" {
|
||||
path = filepath.Join(root, path)
|
||||
}
|
||||
fs := f.c.publishDirServerFs
|
||||
|
||||
fi, err := fs.Stat(path)
|
||||
|
||||
if err == nil {
|
||||
if fi.IsDir() {
|
||||
// There will be overlapping directories, so we
|
||||
// need to check for a file.
|
||||
_, err = f.c.hugo().BaseFs.PublishFs.Stat(filepath.Join(path, "index.html"))
|
||||
_, err = fs.Stat(filepath.Join(path, "index.html"))
|
||||
doRedirect = err != nil
|
||||
} else {
|
||||
doRedirect = false
|
||||
@@ -426,15 +433,28 @@ func (f *fileServer) createEndpoint(i int) (*http.ServeMux, net.Listener, string
|
||||
}
|
||||
|
||||
if doRedirect {
|
||||
if redirect.Status == 200 {
|
||||
switch redirect.Status {
|
||||
case 404:
|
||||
w.WriteHeader(404)
|
||||
file, err := fs.Open(strings.TrimPrefix(redirect.To, u.Path))
|
||||
if err == nil {
|
||||
defer file.Close()
|
||||
io.Copy(w, file)
|
||||
} else {
|
||||
fmt.Fprintln(w, "<h1>Page Not Found</h1>")
|
||||
}
|
||||
return
|
||||
case 200:
|
||||
if r2 := f.rewriteRequest(r, strings.TrimPrefix(redirect.To, u.Path)); r2 != nil {
|
||||
requestURI = redirect.To
|
||||
r = r2
|
||||
}
|
||||
} else {
|
||||
fallthrough
|
||||
default:
|
||||
w.Header().Set("Content-Type", "")
|
||||
http.Redirect(w, r, redirect.To, redirect.Status)
|
||||
return
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+164
-15
@@ -25,6 +25,7 @@ import (
|
||||
|
||||
"github.com/gohugoio/hugo/config"
|
||||
"github.com/gohugoio/hugo/helpers"
|
||||
"github.com/gohugoio/hugo/htesting"
|
||||
"golang.org/x/net/context"
|
||||
"golang.org/x/sync/errgroup"
|
||||
|
||||
@@ -41,12 +42,98 @@ func TestServerPanicOnConfigError(t *testing.T) {
|
||||
linenos='table'
|
||||
`
|
||||
|
||||
r := runServerTest(c, 0, config)
|
||||
r := runServerTest(c,
|
||||
serverTestOptions{
|
||||
config: config,
|
||||
},
|
||||
)
|
||||
|
||||
c.Assert(r.err, qt.IsNotNil)
|
||||
c.Assert(r.err.Error(), qt.Contains, "cannot parse 'Highlight.LineNos' as bool:")
|
||||
}
|
||||
|
||||
func TestServer404(t *testing.T) {
|
||||
c := qt.New(t)
|
||||
|
||||
r := runServerTest(c,
|
||||
serverTestOptions{
|
||||
pathsToGet: []string{"this/does/not/exist"},
|
||||
getNumHomes: 1,
|
||||
},
|
||||
)
|
||||
|
||||
c.Assert(r.err, qt.IsNil)
|
||||
pr := r.pathsResults["this/does/not/exist"]
|
||||
c.Assert(pr.statusCode, qt.Equals, http.StatusNotFound)
|
||||
c.Assert(pr.body, qt.Contains, "404: 404 Page not found|Not Found.")
|
||||
}
|
||||
|
||||
func TestServerPathEncodingIssues(t *testing.T) {
|
||||
c := qt.New(t)
|
||||
|
||||
// Issue 10287
|
||||
c.Run("Unicode paths", func(c *qt.C) {
|
||||
r := runServerTest(c,
|
||||
serverTestOptions{
|
||||
pathsToGet: []string{"hügö/"},
|
||||
getNumHomes: 1,
|
||||
},
|
||||
)
|
||||
|
||||
c.Assert(r.err, qt.IsNil)
|
||||
c.Assert(r.pathsResults["hügö/"].body, qt.Contains, "This is hügö")
|
||||
})
|
||||
|
||||
// Issue 10314
|
||||
c.Run("Windows multilingual 404", func(c *qt.C) {
|
||||
config := `
|
||||
baseURL = 'https://example.org/'
|
||||
title = 'Hugo Forum Topic #40568'
|
||||
|
||||
defaultContentLanguageInSubdir = true
|
||||
|
||||
[languages.en]
|
||||
contentDir = 'content/en'
|
||||
languageCode = 'en-US'
|
||||
languageName = 'English'
|
||||
weight = 1
|
||||
|
||||
[languages.es]
|
||||
contentDir = 'content/es'
|
||||
languageCode = 'es-ES'
|
||||
languageName = 'Espanol'
|
||||
weight = 2
|
||||
|
||||
[server]
|
||||
[[server.redirects]]
|
||||
from = '/en/**'
|
||||
to = '/en/404.html'
|
||||
status = 404
|
||||
|
||||
[[server.redirects]]
|
||||
from = '/es/**'
|
||||
to = '/es/404.html'
|
||||
status = 404
|
||||
`
|
||||
r := runServerTest(c,
|
||||
serverTestOptions{
|
||||
config: config,
|
||||
pathsToGet: []string{"en/this/does/not/exist", "es/this/does/not/exist"},
|
||||
getNumHomes: 1,
|
||||
},
|
||||
)
|
||||
|
||||
c.Assert(r.err, qt.IsNil)
|
||||
pr1 := r.pathsResults["en/this/does/not/exist"]
|
||||
pr2 := r.pathsResults["es/this/does/not/exist"]
|
||||
c.Assert(pr1.statusCode, qt.Equals, http.StatusNotFound)
|
||||
c.Assert(pr2.statusCode, qt.Equals, http.StatusNotFound)
|
||||
c.Assert(pr1.body, qt.Contains, "404: 404 Page not found|Not Found.")
|
||||
c.Assert(pr2.body, qt.Contains, "404: 404 Page not found|Not Found.")
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
func TestServerFlags(t *testing.T) {
|
||||
c := qt.New(t)
|
||||
|
||||
@@ -81,7 +168,13 @@ baseURL="https://example.org"
|
||||
args = strings.Split(test.flag, "=")
|
||||
}
|
||||
|
||||
r := runServerTest(c, 1, config, args...)
|
||||
opts := serverTestOptions{
|
||||
config: config,
|
||||
args: args,
|
||||
getNumHomes: 1,
|
||||
}
|
||||
|
||||
r := runServerTest(c, opts)
|
||||
|
||||
test.assert(c, r)
|
||||
|
||||
@@ -92,6 +185,10 @@ baseURL="https://example.org"
|
||||
}
|
||||
|
||||
func TestServerBugs(t *testing.T) {
|
||||
// TODO(bep) this is flaky on Windows on GH Actions.
|
||||
if htesting.IsGitHubAction() && runtime.GOOS == "windows" {
|
||||
t.Skip("skipping on windows")
|
||||
}
|
||||
c := qt.New(t)
|
||||
|
||||
for _, test := range []struct {
|
||||
@@ -101,6 +198,10 @@ func TestServerBugs(t *testing.T) {
|
||||
numservers int
|
||||
assert func(c *qt.C, r serverTestResult)
|
||||
}{
|
||||
{"PostProcess, memory", "", "", 1, func(c *qt.C, r serverTestResult) {
|
||||
c.Assert(r.err, qt.IsNil)
|
||||
c.Assert(r.homesContent[0], qt.Contains, "PostProcess: /foo.min.css")
|
||||
}},
|
||||
// Issue 9788
|
||||
{"PostProcess, memory", "", "", 1, func(c *qt.C, r serverTestResult) {
|
||||
c.Assert(r.err, qt.IsNil)
|
||||
@@ -140,7 +241,18 @@ baseURL="https://example.org"
|
||||
if test.flag != "" {
|
||||
args = strings.Split(test.flag, "=")
|
||||
}
|
||||
r := runServerTest(c, test.numservers, test.config, args...)
|
||||
|
||||
opts := serverTestOptions{
|
||||
config: test.config,
|
||||
getNumHomes: test.numservers,
|
||||
pathsToGet: []string{"this/does/not/exist"},
|
||||
args: args,
|
||||
}
|
||||
|
||||
r := runServerTest(c, opts)
|
||||
pr := r.pathsResults["this/does/not/exist"]
|
||||
c.Assert(pr.statusCode, qt.Equals, http.StatusNotFound)
|
||||
c.Assert(pr.body, qt.Contains, "404: 404 Page not found|Not Found.")
|
||||
test.assert(c, r)
|
||||
|
||||
})
|
||||
@@ -152,11 +264,29 @@ baseURL="https://example.org"
|
||||
type serverTestResult struct {
|
||||
err error
|
||||
homesContent []string
|
||||
content404 string
|
||||
publicDirnames map[string]bool
|
||||
pathsResults map[string]pathResult
|
||||
}
|
||||
|
||||
func runServerTest(c *qt.C, getNumHomes int, config string, args ...string) (result serverTestResult) {
|
||||
dir := createSimpleTestSite(c, testSiteConfig{configTOML: config})
|
||||
type pathResult struct {
|
||||
statusCode int
|
||||
body string
|
||||
}
|
||||
|
||||
type serverTestOptions struct {
|
||||
getNumHomes int
|
||||
config string
|
||||
pathsToGet []string
|
||||
args []string
|
||||
}
|
||||
|
||||
func runServerTest(c *qt.C, opts serverTestOptions) serverTestResult {
|
||||
dir := createSimpleTestSite(c, testSiteConfig{configTOML: opts.config})
|
||||
result := serverTestResult{
|
||||
publicDirnames: make(map[string]bool),
|
||||
pathsResults: make(map[string]pathResult),
|
||||
}
|
||||
|
||||
sp, err := helpers.FindAvailablePort()
|
||||
c.Assert(err, qt.IsNil)
|
||||
@@ -172,7 +302,7 @@ func runServerTest(c *qt.C, getNumHomes int, config string, args ...string) (res
|
||||
scmd := b.newServerCmdSignaled(stop)
|
||||
|
||||
cmd := scmd.getCommand()
|
||||
args = append([]string{"-s=" + dir, fmt.Sprintf("-p=%d", port)}, args...)
|
||||
args := append([]string{"-s=" + dir, fmt.Sprintf("-p=%d", port)}, opts.args...)
|
||||
cmd.SetArgs(args)
|
||||
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
||||
@@ -184,16 +314,20 @@ func runServerTest(c *qt.C, getNumHomes int, config string, args ...string) (res
|
||||
return err
|
||||
})
|
||||
|
||||
if getNumHomes > 0 {
|
||||
if opts.getNumHomes > 0 {
|
||||
// Esp. on slow CI machines, we need to wait a little before the web
|
||||
// server is ready.
|
||||
time.Sleep(567 * time.Millisecond)
|
||||
result.homesContent = make([]string, getNumHomes)
|
||||
for i := 0; i < getNumHomes; i++ {
|
||||
wait := 567 * time.Millisecond
|
||||
if os.Getenv("CI") != "" {
|
||||
wait = 2 * time.Second
|
||||
}
|
||||
time.Sleep(wait)
|
||||
result.homesContent = make([]string, opts.getNumHomes)
|
||||
for i := 0; i < opts.getNumHomes; i++ {
|
||||
func() {
|
||||
resp, err := http.Get(fmt.Sprintf("http://localhost:%d/", port+i))
|
||||
c.Check(err, qt.IsNil)
|
||||
c.Check(resp.StatusCode, qt.Equals, http.StatusOK)
|
||||
c.Assert(err, qt.IsNil)
|
||||
c.Assert(resp.StatusCode, qt.Equals, http.StatusOK)
|
||||
if err == nil {
|
||||
defer resp.Body.Close()
|
||||
result.homesContent[i] = helpers.ReaderToString(resp.Body)
|
||||
@@ -202,6 +336,22 @@ func runServerTest(c *qt.C, getNumHomes int, config string, args ...string) (res
|
||||
}
|
||||
}
|
||||
|
||||
for _, path := range opts.pathsToGet {
|
||||
func() {
|
||||
resp, err := http.Get(fmt.Sprintf("http://localhost:%d/%s", port, path))
|
||||
c.Assert(err, qt.IsNil)
|
||||
pr := pathResult{
|
||||
statusCode: resp.StatusCode,
|
||||
}
|
||||
|
||||
if err == nil {
|
||||
defer resp.Body.Close()
|
||||
pr.body = helpers.ReaderToString(resp.Body)
|
||||
}
|
||||
result.pathsResults[path] = pr
|
||||
}()
|
||||
}
|
||||
|
||||
time.Sleep(1 * time.Second)
|
||||
|
||||
select {
|
||||
@@ -210,15 +360,14 @@ func runServerTest(c *qt.C, getNumHomes int, config string, args ...string) (res
|
||||
}
|
||||
|
||||
pubFiles, err := os.ReadDir(filepath.Join(dir, "public"))
|
||||
c.Check(err, qt.IsNil)
|
||||
result.publicDirnames = make(map[string]bool)
|
||||
c.Assert(err, qt.IsNil)
|
||||
for _, f := range pubFiles {
|
||||
result.publicDirnames[f.Name()] = true
|
||||
}
|
||||
|
||||
result.err = wg.Wait()
|
||||
|
||||
return
|
||||
return result
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -16,8 +16,6 @@ package hugio
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/spf13/afero"
|
||||
@@ -53,7 +51,7 @@ func CopyFile(fs afero.Fs, from, to string) error {
|
||||
|
||||
// CopyDir copies a directory.
|
||||
func CopyDir(fs afero.Fs, from, to string, shouldCopy func(filename string) bool) error {
|
||||
fi, err := os.Stat(from)
|
||||
fi, err := fs.Stat(from)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -67,7 +65,7 @@ func CopyDir(fs afero.Fs, from, to string, shouldCopy func(filename string) bool
|
||||
return err
|
||||
}
|
||||
|
||||
entries, _ := ioutil.ReadDir(from)
|
||||
entries, _ := afero.ReadDir(fs, from)
|
||||
for _, entry := range entries {
|
||||
fromFilename := filepath.Join(from, entry.Name())
|
||||
toFilename := filepath.Join(to, entry.Name())
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
// Copyright 2022 The Hugo Authors. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package hugio
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
)
|
||||
|
||||
// HasBytesWriter is a writer that will set Match to true if the given pattern
|
||||
// is found in the stream.
|
||||
type HasBytesWriter struct {
|
||||
Match bool
|
||||
Pattern []byte
|
||||
|
||||
i int
|
||||
done bool
|
||||
buff []byte
|
||||
}
|
||||
|
||||
func (h *HasBytesWriter) Write(p []byte) (n int, err error) {
|
||||
if h.done {
|
||||
return len(p), nil
|
||||
}
|
||||
|
||||
if len(h.buff) == 0 {
|
||||
h.buff = make([]byte, len(h.Pattern)*2)
|
||||
}
|
||||
|
||||
for i := range p {
|
||||
h.buff[h.i] = p[i]
|
||||
h.i++
|
||||
if h.i == len(h.buff) {
|
||||
// Shift left.
|
||||
copy(h.buff, h.buff[len(h.buff)/2:])
|
||||
h.i = len(h.buff) / 2
|
||||
}
|
||||
|
||||
if bytes.Contains(h.buff, h.Pattern) {
|
||||
h.Match = true
|
||||
h.done = true
|
||||
return len(p), nil
|
||||
}
|
||||
}
|
||||
|
||||
return len(p), nil
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
// Copyright 2022 The Hugo Authors. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package hugio
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io"
|
||||
"math/rand"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
qt "github.com/frankban/quicktest"
|
||||
)
|
||||
|
||||
func TestHasBytesWriter(t *testing.T) {
|
||||
r := rand.New(rand.NewSource(time.Now().UnixNano()))
|
||||
|
||||
c := qt.New((t))
|
||||
|
||||
neww := func() (*HasBytesWriter, io.Writer) {
|
||||
var b bytes.Buffer
|
||||
|
||||
h := &HasBytesWriter{
|
||||
Pattern: []byte("__foo"),
|
||||
}
|
||||
return h, io.MultiWriter(&b, h)
|
||||
}
|
||||
|
||||
rndStr := func() string {
|
||||
return strings.Repeat("ab cfo", r.Intn(33))
|
||||
}
|
||||
|
||||
for i := 0; i < 22; i++ {
|
||||
h, w := neww()
|
||||
fmt.Fprintf(w, rndStr()+"abc __foobar"+rndStr())
|
||||
c.Assert(h.Match, qt.Equals, true)
|
||||
|
||||
h, w = neww()
|
||||
fmt.Fprintf(w, rndStr()+"abc __f")
|
||||
fmt.Fprintf(w, "oo bar"+rndStr())
|
||||
c.Assert(h.Match, qt.Equals, true)
|
||||
|
||||
h, w = neww()
|
||||
fmt.Fprintf(w, rndStr()+"abc __moo bar")
|
||||
c.Assert(h.Match, qt.Equals, false)
|
||||
}
|
||||
|
||||
h, w := neww()
|
||||
fmt.Fprintf(w, "__foo")
|
||||
c.Assert(h.Match, qt.Equals, true)
|
||||
}
|
||||
+2
-2
@@ -68,7 +68,7 @@ func (i Info) Version() VersionString {
|
||||
|
||||
// Generator a Hugo meta generator HTML tag.
|
||||
func (i Info) Generator() template.HTML {
|
||||
return template.HTML(fmt.Sprintf(`<meta name="generator" content="Hugo %s" />`, CurrentVersion.String()))
|
||||
return template.HTML(fmt.Sprintf(`<meta name="generator" content="Hugo %s">`, CurrentVersion.String()))
|
||||
}
|
||||
|
||||
func (i Info) IsProduction() bool {
|
||||
@@ -198,7 +198,7 @@ func GetDependencyList() []string {
|
||||
deps,
|
||||
// TODO(bep) consider adding a DepsNonGo() method to these upstream projects.
|
||||
formatDep("github.com/sass/libsass", "3.6.5"),
|
||||
formatDep("github.com/webmproject/libwebp", "v1.2.0"),
|
||||
formatDep("github.com/webmproject/libwebp", "v1.2.4"),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ package hugo
|
||||
// This should be the only one.
|
||||
var CurrentVersion = Version{
|
||||
Major: 0,
|
||||
Minor: 102,
|
||||
Minor: 106,
|
||||
PatchLevel: 0,
|
||||
Suffix: "-DEV",
|
||||
Suffix: "",
|
||||
}
|
||||
|
||||
+30
-10
@@ -180,10 +180,15 @@ type Headers struct {
|
||||
}
|
||||
|
||||
type Redirect struct {
|
||||
From string
|
||||
To string
|
||||
From string
|
||||
To string
|
||||
|
||||
// HTTP status code to use for the redirect.
|
||||
// A status code of 200 will trigger a URL rewrite.
|
||||
Status int
|
||||
Force bool
|
||||
|
||||
// Forcode redirect, even if original request path exists.
|
||||
Force bool
|
||||
}
|
||||
|
||||
func (r Redirect) IsZero() bool {
|
||||
@@ -200,16 +205,31 @@ func DecodeServer(cfg Provider) (*Server, error) {
|
||||
_ = mapstructure.WeakDecode(m, s)
|
||||
|
||||
for i, redir := range s.Redirects {
|
||||
// Get it in line with the Hugo server.
|
||||
redir.To = strings.TrimSuffix(redir.To, "index.html")
|
||||
if !strings.HasPrefix(redir.To, "https") && !strings.HasSuffix(redir.To, "/") {
|
||||
// There are some tricky infinite loop situations when dealing
|
||||
// when the target does not have a trailing slash.
|
||||
// This can certainly be handled better, but not time for that now.
|
||||
return nil, fmt.Errorf("unsupported redirect to value %q in server config; currently this must be either a remote destination or a local folder, e.g. \"/blog/\" or \"/blog/index.html\"", redir.To)
|
||||
// Get it in line with the Hugo server for OK responses.
|
||||
// We currently treat the 404 as a special case, they are always "ugly", so keep them as is.
|
||||
if redir.Status != 404 {
|
||||
redir.To = strings.TrimSuffix(redir.To, "index.html")
|
||||
if !strings.HasPrefix(redir.To, "https") && !strings.HasSuffix(redir.To, "/") {
|
||||
// There are some tricky infinite loop situations when dealing
|
||||
// when the target does not have a trailing slash.
|
||||
// This can certainly be handled better, but not time for that now.
|
||||
return nil, fmt.Errorf("unsupported redirect to value %q in server config; currently this must be either a remote destination or a local folder, e.g. \"/blog/\" or \"/blog/index.html\"", redir.To)
|
||||
}
|
||||
}
|
||||
s.Redirects[i] = redir
|
||||
}
|
||||
|
||||
if len(s.Redirects) == 0 {
|
||||
// Set up a default redirect for 404s.
|
||||
s.Redirects = []Redirect{
|
||||
{
|
||||
From: "**",
|
||||
To: "/404.html",
|
||||
Status: 404,
|
||||
},
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return s, nil
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ var DefaultConfig = Config{
|
||||
),
|
||||
// These have been tested to work with Hugo's external programs
|
||||
// on Windows, Linux and MacOS.
|
||||
OsEnv: NewWhitelist("(?i)^(PATH|PATHEXT|APPDATA|TMP|TEMP|TERM)$"),
|
||||
OsEnv: NewWhitelist("(?i)^((HTTPS?|NO)_PROXY|PATH(EXT)?|APPDATA|TE?MP|TERM)$"),
|
||||
},
|
||||
Funcs: Funcs{
|
||||
Getenv: NewWhitelist("^HUGO_"),
|
||||
|
||||
@@ -140,7 +140,7 @@ func TestToTOML(t *testing.T) {
|
||||
got := DefaultConfig.ToTOML()
|
||||
|
||||
c.Assert(got, qt.Equals,
|
||||
"[security]\n enableInlineShortcodes = false\n [security.exec]\n allow = ['^dart-sass-embedded$', '^go$', '^npx$', '^postcss$']\n osEnv = ['(?i)^(PATH|PATHEXT|APPDATA|TMP|TEMP|TERM)$']\n\n [security.funcs]\n getenv = ['^HUGO_']\n\n [security.http]\n methods = ['(?i)GET|POST']\n urls = ['.*']",
|
||||
"[security]\n enableInlineShortcodes = false\n\n [security.exec]\n allow = ['^dart-sass-embedded$', '^go$', '^npx$', '^postcss$']\n osEnv = ['(?i)^((HTTPS?|NO)_PROXY|PATH(EXT)?|APPDATA|TE?MP|TERM)$']\n\n [security.funcs]\n getenv = ['^HUGO_']\n\n [security.http]\n methods = ['(?i)GET|POST']\n urls = ['.*']",
|
||||
)
|
||||
}
|
||||
|
||||
+5
-3
@@ -52,7 +52,7 @@ draft: true
|
||||
|
||||
// NewContent creates a new content file in h (or a full bundle if the archetype is a directory)
|
||||
// in targetPath.
|
||||
func NewContent(h *hugolib.HugoSites, kind, targetPath string) error {
|
||||
func NewContent(h *hugolib.HugoSites, kind, targetPath string, force bool) error {
|
||||
if h.BaseFs.Content.Dirs == nil {
|
||||
return errors.New("no existing content directory configured for this project")
|
||||
}
|
||||
@@ -76,6 +76,7 @@ func NewContent(h *hugolib.HugoSites, kind, targetPath string) error {
|
||||
|
||||
kind: kind,
|
||||
targetPath: targetPath,
|
||||
force: force,
|
||||
}
|
||||
|
||||
ext := paths.Ext(targetPath)
|
||||
@@ -132,6 +133,7 @@ type contentBuilder struct {
|
||||
kind string
|
||||
isDir bool
|
||||
dirMap archetypeMap
|
||||
force bool
|
||||
}
|
||||
|
||||
func (b *contentBuilder) buildDir() error {
|
||||
@@ -145,7 +147,7 @@ func (b *contentBuilder) buildDir() error {
|
||||
|
||||
for _, fi := range b.dirMap.contentFiles {
|
||||
targetFilename := filepath.Join(b.targetPath, strings.TrimPrefix(fi.Meta().Path, b.archetypeFilename))
|
||||
abs, err := b.cf.CreateContentPlaceHolder(targetFilename)
|
||||
abs, err := b.cf.CreateContentPlaceHolder(targetFilename, b.force)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -218,7 +220,7 @@ func (b *contentBuilder) buildDir() error {
|
||||
}
|
||||
|
||||
func (b *contentBuilder) buildFile() (string, error) {
|
||||
contentPlaceholderAbsFilename, err := b.cf.CreateContentPlaceHolder(b.targetPath)
|
||||
contentPlaceholderAbsFilename, err := b.cf.CreateContentPlaceHolder(b.targetPath, b.force)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
+36
-9
@@ -82,7 +82,7 @@ func TestNewContentFromFile(t *testing.T) {
|
||||
cfg, fs := newTestCfg(c, mm)
|
||||
h, err := hugolib.NewHugoSites(deps.DepsCfg{Cfg: cfg, Fs: fs})
|
||||
c.Assert(err, qt.IsNil)
|
||||
err = create.NewContent(h, cas.kind, cas.path)
|
||||
err = create.NewContent(h, cas.kind, cas.path, false)
|
||||
|
||||
if b, ok := cas.expected.(bool); ok && !b {
|
||||
if !b {
|
||||
@@ -145,7 +145,7 @@ i18n: {{ T "hugo" }}
|
||||
c.Assert(err, qt.IsNil)
|
||||
c.Assert(len(h.Sites), qt.Equals, 2)
|
||||
|
||||
c.Assert(create.NewContent(h, "my-bundle", "post/my-post"), qt.IsNil)
|
||||
c.Assert(create.NewContent(h, "my-bundle", "post/my-post", false), qt.IsNil)
|
||||
|
||||
cContains(c, readFileFromFs(t, fs.Source, filepath.Join("content", "post/my-post/resources/hugo1.json")), `hugo1: {{ printf "no template handling in here" }}`)
|
||||
cContains(c, readFileFromFs(t, fs.Source, filepath.Join("content", "post/my-post/resources/hugo2.xml")), `hugo2: {{ printf "no template handling in here" }}`)
|
||||
@@ -157,7 +157,7 @@ i18n: {{ T "hugo" }}
|
||||
|
||||
cContains(c, readFileFromFs(t, fs.Source, filepath.Join("content", "post/my-post/pages/bio.md")), `File: bio.md`, `Site Lang: en`, `Name: Bio`)
|
||||
|
||||
c.Assert(create.NewContent(h, "my-theme-bundle", "post/my-theme-post"), qt.IsNil)
|
||||
c.Assert(create.NewContent(h, "my-theme-bundle", "post/my-theme-post", false), qt.IsNil)
|
||||
cContains(c, readFileFromFs(t, fs.Source, filepath.Join("content", "post/my-theme-post/index.md")), `File: index.md`, `Site Lang: en`, `Name: My Theme Post`, `i18n: Hugo Rocks!`)
|
||||
cContains(c, readFileFromFs(t, fs.Source, filepath.Join("content", "post/my-theme-post/resources/hugo1.json")), `hugo1: {{ printf "no template handling in here" }}`)
|
||||
}
|
||||
@@ -187,19 +187,19 @@ site RegularPages: {{ len site.RegularPages }}
|
||||
c.Assert(err, qt.IsNil)
|
||||
c.Assert(len(h.Sites), qt.Equals, 2)
|
||||
|
||||
c.Assert(create.NewContent(h, "my-bundle", "post/my-post"), qt.IsNil)
|
||||
c.Assert(create.NewContent(h, "my-bundle", "post/my-post", false), qt.IsNil)
|
||||
cContains(c, readFileFromFs(t, fs.Source, filepath.Join("content", "post/my-post/index.md")), `site RegularPages: 10`)
|
||||
|
||||
// Default bundle archetype
|
||||
c.Assert(create.NewContent(h, "", "post/my-post2"), qt.IsNil)
|
||||
c.Assert(create.NewContent(h, "", "post/my-post2", false), qt.IsNil)
|
||||
cContains(c, readFileFromFs(t, fs.Source, filepath.Join("content", "post/my-post2/index.md")), `default archetype index.md`)
|
||||
|
||||
// Regular file with bundle kind.
|
||||
c.Assert(create.NewContent(h, "my-bundle", "post/foo.md"), qt.IsNil)
|
||||
c.Assert(create.NewContent(h, "my-bundle", "post/foo.md", false), qt.IsNil)
|
||||
cContains(c, readFileFromFs(t, fs.Source, filepath.Join("content", "post/foo.md")), `draft: true`)
|
||||
|
||||
// Regular files should fall back to the default archetype (we have no regular file archetype).
|
||||
c.Assert(create.NewContent(h, "my-bundle", "mypage.md"), qt.IsNil)
|
||||
c.Assert(create.NewContent(h, "my-bundle", "mypage.md", false), qt.IsNil)
|
||||
cContains(c, readFileFromFs(t, fs.Source, filepath.Join("content", "mypage.md")), `draft: true`)
|
||||
|
||||
}
|
||||
@@ -237,7 +237,7 @@ i18n: {{ T "hugo" }}
|
||||
c.Assert(err, qt.IsNil)
|
||||
c.Assert(len(h.Sites), qt.Equals, 2)
|
||||
|
||||
c.Assert(create.NewContent(h, "my-bundle", "post/my-post"), qt.IsNil)
|
||||
c.Assert(create.NewContent(h, "my-bundle", "post/my-post", false), qt.IsNil)
|
||||
|
||||
cContains(c, readFileFromFs(t, fs.Source, filepath.Join("content", "post/my-post/resources/hugo1.json")), `hugo1: {{ printf "no template handling in here" }}`)
|
||||
cContains(c, readFileFromFs(t, fs.Source, filepath.Join("content", "post/my-post/resources/hugo2.xml")), `hugo2: {{ printf "no template handling in here" }}`)
|
||||
@@ -247,11 +247,38 @@ i18n: {{ T "hugo" }}
|
||||
|
||||
cContains(c, readFileFromFs(t, fs.Source, filepath.Join("content", "post/my-post/pages/bio.md")), `File: bio.md`, `Name: Bio`)
|
||||
|
||||
c.Assert(create.NewContent(h, "my-theme-bundle", "post/my-theme-post"), qt.IsNil)
|
||||
c.Assert(create.NewContent(h, "my-theme-bundle", "post/my-theme-post", false), qt.IsNil)
|
||||
cContains(c, readFileFromFs(t, fs.Source, filepath.Join("content", "post/my-theme-post/index.md")), `File: index.md`, `Name: My Theme Post`, `i18n: Hugo Rocks!`)
|
||||
cContains(c, readFileFromFs(t, fs.Source, filepath.Join("content", "post/my-theme-post/resources/hugo1.json")), `hugo1: {{ printf "no template handling in here" }}`)
|
||||
}
|
||||
|
||||
func TestNewContentForce(t *testing.T) {
|
||||
mm := afero.NewMemMapFs()
|
||||
c := qt.New(t)
|
||||
|
||||
archetypeDir := filepath.Join("archetypes", "my-bundle")
|
||||
c.Assert(mm.MkdirAll(archetypeDir, 0o755), qt.IsNil)
|
||||
c.Assert(afero.WriteFile(mm, filepath.Join(archetypeDir, "index.md"), []byte(""), 0o755), qt.IsNil)
|
||||
c.Assert(afero.WriteFile(mm, filepath.Join(archetypeDir, "index.nn.md"), []byte(""), 0o755), qt.IsNil)
|
||||
|
||||
c.Assert(initFs(mm), qt.IsNil)
|
||||
cfg, fs := newTestCfg(c, mm)
|
||||
|
||||
h, err := hugolib.NewHugoSites(deps.DepsCfg{Cfg: cfg, Fs: fs})
|
||||
c.Assert(err, qt.IsNil)
|
||||
c.Assert(len(h.Sites), qt.Equals, 2)
|
||||
|
||||
// from file
|
||||
c.Assert(create.NewContent(h, "post", "post/my-post.md", false), qt.IsNil)
|
||||
c.Assert(create.NewContent(h, "post", "post/my-post.md", false), qt.IsNotNil)
|
||||
c.Assert(create.NewContent(h, "post", "post/my-post.md", true), qt.IsNil)
|
||||
|
||||
// from dir
|
||||
c.Assert(create.NewContent(h, "my-bundle", "post/my-post", false), qt.IsNil)
|
||||
c.Assert(create.NewContent(h, "my-bundle", "post/my-post", false), qt.IsNotNil)
|
||||
c.Assert(create.NewContent(h, "my-bundle", "post/my-post", true), qt.IsNil)
|
||||
}
|
||||
|
||||
func initFs(fs afero.Fs) error {
|
||||
perm := os.FileMode(0o755)
|
||||
var err error
|
||||
|
||||
Vendored
+35
-1
@@ -2,6 +2,8 @@ package deps
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
@@ -16,6 +18,7 @@ import (
|
||||
"github.com/gohugoio/hugo/langs"
|
||||
"github.com/gohugoio/hugo/media"
|
||||
"github.com/gohugoio/hugo/resources/page"
|
||||
"github.com/gohugoio/hugo/resources/postpub"
|
||||
|
||||
"github.com/gohugoio/hugo/metrics"
|
||||
"github.com/gohugoio/hugo/output"
|
||||
@@ -78,6 +81,10 @@ type Deps struct {
|
||||
// All the output formats available for the current site.
|
||||
OutputFormatsConfig output.Formats
|
||||
|
||||
// FilenameHasPostProcessPrefix is a set of filenames in /public that
|
||||
// contains a post-processing prefix.
|
||||
FilenameHasPostProcessPrefix []string
|
||||
|
||||
templateProvider ResourceProvider
|
||||
WithTemplate func(templ tpl.TemplateManager) error `json:"-"`
|
||||
|
||||
@@ -202,6 +209,7 @@ func New(cfg DepsCfg) (*Deps, error) {
|
||||
var (
|
||||
logger = cfg.Logger
|
||||
fs = cfg.Fs
|
||||
d *Deps
|
||||
)
|
||||
|
||||
if cfg.TemplateProvider == nil {
|
||||
@@ -239,6 +247,32 @@ func New(cfg DepsCfg) (*Deps, error) {
|
||||
}
|
||||
execHelper := hexec.New(securityConfig)
|
||||
|
||||
var filenameHasPostProcessPrefixMu sync.Mutex
|
||||
hashBytesReceiverFunc := func(name string, match bool) {
|
||||
if !match {
|
||||
return
|
||||
}
|
||||
filenameHasPostProcessPrefixMu.Lock()
|
||||
d.FilenameHasPostProcessPrefix = append(d.FilenameHasPostProcessPrefix, name)
|
||||
filenameHasPostProcessPrefixMu.Unlock()
|
||||
}
|
||||
|
||||
// Skip binary files.
|
||||
hashBytesSHouldCheck := func(name string) bool {
|
||||
ext := strings.TrimPrefix(filepath.Ext(name), ".")
|
||||
mime, _, found := cfg.MediaTypes.GetBySuffix(ext)
|
||||
if !found {
|
||||
return false
|
||||
}
|
||||
switch mime.MainType {
|
||||
case "text", "application":
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
fs.PublishDir = hugofs.NewHasBytesReceiver(fs.PublishDir, hashBytesSHouldCheck, hashBytesReceiverFunc, []byte(postpub.PostProcessPrefix))
|
||||
|
||||
ps, err := helpers.NewPathSpec(fs, cfg.Language, logger)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("create PathSpec: %w", err)
|
||||
@@ -274,7 +308,7 @@ func New(cfg DepsCfg) (*Deps, error) {
|
||||
|
||||
logDistinct := helpers.NewDistinctLogger(logger)
|
||||
|
||||
d := &Deps{
|
||||
d = &Deps{
|
||||
Fs: fs,
|
||||
Log: ignorableLogger,
|
||||
LogDistinct: logDistinct,
|
||||
|
||||
+28
-2
@@ -34,6 +34,7 @@
|
||||
"brlink",
|
||||
"Brotli",
|
||||
"Browsersync",
|
||||
"canonicalization",
|
||||
"canonify",
|
||||
"Catmull",
|
||||
"Catwoman",
|
||||
@@ -61,6 +62,8 @@
|
||||
"datatable",
|
||||
"DATOCMS",
|
||||
"debugconfig",
|
||||
"defang",
|
||||
"Deindent",
|
||||
"DELIM",
|
||||
"dhersam",
|
||||
"digitalcraftsman",
|
||||
@@ -72,17 +75,21 @@
|
||||
"DRING",
|
||||
"Eiqc",
|
||||
"Eliott",
|
||||
"embeddable",
|
||||
"Emojify",
|
||||
"Enwrite",
|
||||
"eopkg",
|
||||
"eparis",
|
||||
"errorf",
|
||||
"erroridf",
|
||||
"esbuild",
|
||||
"Evernote",
|
||||
"Exif",
|
||||
"exitwp",
|
||||
"expirydate",
|
||||
"Feminella",
|
||||
"firstpost",
|
||||
"Flickr",
|
||||
"Formspree",
|
||||
"fpath",
|
||||
"Francia",
|
||||
@@ -91,10 +98,12 @@
|
||||
"funcs",
|
||||
"funcsig",
|
||||
"Garen",
|
||||
"Garuda",
|
||||
"gcloud",
|
||||
"Getenv",
|
||||
"getjson",
|
||||
"getpage",
|
||||
"Gitee",
|
||||
"Gmfc",
|
||||
"Goel",
|
||||
"Gohugo",
|
||||
@@ -106,6 +115,7 @@
|
||||
"govendor",
|
||||
"Gowans",
|
||||
"Grayscale",
|
||||
"Gregor",
|
||||
"Gruber",
|
||||
"gtag",
|
||||
"gvfs",
|
||||
@@ -141,10 +151,12 @@
|
||||
"Joomla",
|
||||
"JRBR",
|
||||
"jsonify",
|
||||
"Karmada",
|
||||
"katex",
|
||||
"keycdn",
|
||||
"KEYVALS",
|
||||
"kubernetes",
|
||||
"Kubuntu",
|
||||
"Lanczos",
|
||||
"langformatnumber",
|
||||
"lastmod",
|
||||
@@ -152,6 +164,7 @@
|
||||
"linktitle",
|
||||
"Lipi",
|
||||
"lrwxr",
|
||||
"Lubuntu",
|
||||
"maingo",
|
||||
"markdownified",
|
||||
"markdownify",
|
||||
@@ -188,6 +201,7 @@
|
||||
"newparam",
|
||||
"Nichlas",
|
||||
"Nikhil",
|
||||
"Nikola",
|
||||
"Njjy",
|
||||
"nlist",
|
||||
"nobr",
|
||||
@@ -221,6 +235,7 @@
|
||||
"Poupin",
|
||||
"prerender",
|
||||
"println",
|
||||
"Pritchard",
|
||||
"publishdate",
|
||||
"Pygments",
|
||||
"qref",
|
||||
@@ -249,6 +264,7 @@
|
||||
"safejs",
|
||||
"Samsa",
|
||||
"schemaorg",
|
||||
"setx",
|
||||
"Shekhar",
|
||||
"Shortcode",
|
||||
"Shortcodes",
|
||||
@@ -257,7 +273,9 @@
|
||||
"Sindre",
|
||||
"sitemapindex",
|
||||
"sitemapxml",
|
||||
"slugorfilename",
|
||||
"Smartcrop",
|
||||
"Sobre",
|
||||
"Sprintf",
|
||||
"Startseite",
|
||||
"strconv",
|
||||
@@ -278,6 +296,7 @@
|
||||
"Tknx",
|
||||
"TLDR",
|
||||
"TMPDIR",
|
||||
"toclevels",
|
||||
"TOCSS",
|
||||
"todos",
|
||||
"tojson",
|
||||
@@ -288,6 +307,8 @@
|
||||
"toyaml",
|
||||
"twitteruser",
|
||||
"Unmarshal",
|
||||
"unpublishdate",
|
||||
"Unsharp",
|
||||
"urlize",
|
||||
"urlset",
|
||||
"utimestamp",
|
||||
@@ -301,15 +322,19 @@
|
||||
"wibble",
|
||||
"wordcount",
|
||||
"workson",
|
||||
"Wowchemy",
|
||||
"wpxr",
|
||||
"Xbaabbab",
|
||||
"Xubuntu",
|
||||
"xvzf",
|
||||
"yoyoyo",
|
||||
"yunbox",
|
||||
"Zgotmpl",
|
||||
"Zorin",
|
||||
"zzbbaabb",
|
||||
"مدونتي"
|
||||
],
|
||||
"language": "en,en-GB,en-US,de,fr",
|
||||
"language": "en,en-US,de,fr",
|
||||
"allowCompoundWords": true,
|
||||
"files": [
|
||||
"**/*.md"
|
||||
@@ -331,5 +356,6 @@
|
||||
"**/news/*",
|
||||
"**/showcase/*"
|
||||
],
|
||||
"useGitignore": true
|
||||
"useGitignore": true,
|
||||
"enabled": true
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -17,6 +17,6 @@ markComment: >
|
||||
If you still think this is important, please tell us why.
|
||||
|
||||
This issue will automatically be closed in the near future if no further activity occurs. Thank you for all your contributions.
|
||||
|
||||
|
||||
# Comment to post when closing a stale issue. Set to `false` to disable
|
||||
closeComment: false
|
||||
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
name: "CodeQL"
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0 0 1 * *"
|
||||
|
||||
jobs:
|
||||
analyze:
|
||||
name: Analyze
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
actions: read
|
||||
contents: read
|
||||
security-events: write
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v2
|
||||
with:
|
||||
languages: "javascript"
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v2
|
||||
+3
-2
@@ -1,4 +1,4 @@
|
||||
name: 'Check spelling'
|
||||
name: "Check spelling"
|
||||
on: # rebuild any PRs and main branch changes
|
||||
push:
|
||||
branches-ignore:
|
||||
@@ -15,6 +15,7 @@ jobs:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: streetsidesoftware/cspell-action@v2
|
||||
with:
|
||||
check_dot_files: false
|
||||
incremental_files_only: true
|
||||
inline: warning
|
||||
strict: false
|
||||
incremental_files_only: true
|
||||
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
name: Super Linter
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read # to fetch code (actions/checkout)
|
||||
|
||||
jobs:
|
||||
build:
|
||||
permissions:
|
||||
contents: read # to fetch code (actions/checkout)
|
||||
statuses: write # to mark status of each linter run (github/super-linter/slim)
|
||||
|
||||
name: Lint Code Base
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ github.actor != 'dependabot[bot]' }}
|
||||
|
||||
steps:
|
||||
- name: Checkout Code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Lint Code Base
|
||||
uses: github/super-linter/slim@v4
|
||||
env:
|
||||
DEFAULT_BRANCH: master
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
IGNORE_GITIGNORED_FILES: true
|
||||
LINTER_RULES_PATH: /
|
||||
LOG_LEVEL: NOTICE
|
||||
MARKDOWN_CONFIG_FILE: .markdownlint.yaml
|
||||
SUPPRESS_POSSUM: true
|
||||
VALIDATE_CSS: false
|
||||
VALIDATE_EDITORCONFIG: false
|
||||
VALIDATE_GITLEAKS: false
|
||||
VALIDATE_HTML: false
|
||||
VALIDATE_JAVASCRIPT_STANDARD: false
|
||||
VALIDATE_JSCPD: false
|
||||
VALIDATE_NATURAL_LANGUAGE: false
|
||||
VALIDATE_SHELL_SHFMT: false
|
||||
VALIDATE_XML: false
|
||||
@@ -1,6 +1,7 @@
|
||||
/.idea
|
||||
/.vscode
|
||||
/public
|
||||
/dist
|
||||
node_modules
|
||||
nohup.out
|
||||
.DS_Store
|
||||
|
||||
+22
-2
@@ -1,4 +1,24 @@
|
||||
# https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md
|
||||
|
||||
MD013: false # Line length
|
||||
MD033: false # Inline HTML
|
||||
MD002: false
|
||||
MD003: false
|
||||
MD004: false
|
||||
MD007: false
|
||||
MD012:
|
||||
maximum: 2
|
||||
MD013: false
|
||||
MD014: false
|
||||
MD022: false
|
||||
MD024: false
|
||||
MD031: false
|
||||
MD032: false
|
||||
MD033: false
|
||||
MD034: false
|
||||
MD036: false
|
||||
MD037: false
|
||||
MD038: false
|
||||
MD041: false
|
||||
MD046: false
|
||||
MD049: false
|
||||
MD050: false
|
||||
MD053: false
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
**/commands/**
|
||||
**/functions/**
|
||||
**/news/**
|
||||
**/showcase/**
|
||||
**/zh/**
|
||||
**/license.md
|
||||
@@ -0,0 +1,3 @@
|
||||
**/news/**
|
||||
**/showcase/**
|
||||
**/zh/**
|
||||
Vendored
+2
-1
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"recommendations": [
|
||||
"DavidAnson.vscode-markdownlint",
|
||||
"EditorConfig.EditorConfig",
|
||||
"esbenp.prettier-vscode",
|
||||
"streetsidesoftware.code-spell-checker"
|
||||
]
|
||||
}
|
||||
|
||||
+3
-3
@@ -7,11 +7,11 @@ Documentation site for [Hugo](https://github.com/gohugoio/hugo), the very fast a
|
||||
|
||||
## Contributing
|
||||
|
||||
We welcome contributions to Hugo of any kind including documentation, suggestions, bug reports, pull requests etc. Also check out our [contribution guide](https://gohugo.io/contribute/documentation/). We would love to hear from you.
|
||||
We welcome contributions to Hugo of any kind including documentation, suggestions, bug reports, pull requests etc. Also check out our [contribution guide](https://gohugo.io/contribute/documentation/). We would love to hear from you.
|
||||
|
||||
Note that this repository contains solely the documentation for Hugo. For contributions that aren't documentation-related please refer to the [hugo](https://github.com/gohugoio/hugo) repository.
|
||||
Note that this repository contains solely the documentation for Hugo. For contributions that aren't documentation-related please refer to the [hugo](https://github.com/gohugoio/hugo) repository.
|
||||
|
||||
*Pull requests shall **only** contain changes to the actual documentation. However, changes on the code base of Hugo **and** the documentation shall be a single, atomic pull request in the [hugo](https://github.com/gohugoio/hugo) repository.*
|
||||
*Pull requests shall **only** contain changes to the actual documentation. However, changes on the codebase of Hugo **and** the documentation shall be a single, atomic pull request in the [hugo](https://github.com/gohugoio/hugo) repository.*
|
||||
|
||||
Spelling fixes are most welcomed, and if you want to contribute longer sections to the documentation, it would be great if you had the following criteria in mind when writing:
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
/* From http://cssfontstack.com */
|
||||
/* From https://www.cssfontstack.com */
|
||||
code, .code, pre code, .highlight pre {
|
||||
font-family: 'inconsolata',Menlo,Monaco,'Courier New',monospace;
|
||||
}
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
/* modified from:*/
|
||||
@import 'highlight.js/styles/atom-one-light.css';
|
||||
|
||||
/* hljs-template-variable covers the handlebars templating*/
|
||||
.hljs-template-variable {
|
||||
color: var(--primary-color);
|
||||
}
|
||||
|
||||
.hljs-attr {
|
||||
color: var(--accent-color-light);
|
||||
}
|
||||
+10
-11
@@ -1,12 +1,11 @@
|
||||
require("typeface-muli")
|
||||
require('typeface-muli');
|
||||
import styles from './css/main.css';
|
||||
import './js/clipboardjs.js'
|
||||
import './js/codeblocks.js'
|
||||
import './js/docsearch.js'
|
||||
import './js/hljs.js'
|
||||
import './js/lazysizes.js'
|
||||
import './js/menutoggle.js'
|
||||
import './js/scrolldir.js'
|
||||
import './js/smoothscroll.js'
|
||||
import './js/tabs.js'
|
||||
import './js/nojs.js'
|
||||
import './js/clipboardjs.js';
|
||||
import './js/codeblocks.js';
|
||||
import './js/docsearch.js';
|
||||
import './js/lazysizes.js';
|
||||
import './js/menutoggle.js';
|
||||
import './js/scrolldir.js';
|
||||
import './js/smoothscroll.js';
|
||||
import './js/tabs.js';
|
||||
import './js/nojs.js';
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
var hljs = require('highlight.js/lib/highlight.js');
|
||||
|
||||
hljs.registerLanguage('bash', require('highlight.js/lib/languages/bash'));
|
||||
hljs.registerLanguage('css', require('highlight.js/lib/languages/css'));
|
||||
hljs.registerLanguage('markdown', require('highlight.js/lib/languages/markdown'));
|
||||
hljs.registerLanguage('diff', require('highlight.js/lib/languages/diff'));
|
||||
// hljs.registerLanguage('go', require('highlight.js/lib/languages/go'));
|
||||
hljs.registerLanguage('javascript', require('highlight.js/lib/languages/javascript'));
|
||||
hljs.registerLanguage('json', require('highlight.js/lib/languages/json'));
|
||||
hljs.registerLanguage('yaml', require('highlight.js/lib/languages/yaml'));
|
||||
hljs.registerLanguage('xml', require('highlight.js/lib/languages/xml'));
|
||||
hljs.registerLanguage('html', require('highlight.js/lib/languages/handlebars'));
|
||||
|
||||
hljs.registerLanguage("go", function(e) {
|
||||
var t = { keyword: "code output note warning break default func interface select case map struct chan else goto package switch const fallthrough if range end type continue for import return var go defer bool byte complex64 complex128 float32 float64 int8 int16 int32 int64 string uint8 uint16 uint32 uint64 int uint uintptr rune id autoplay Get", literal: "file download copy true false iota nil Pages with", built_in: "append cap close complex highlight copy imag len make new panic print println real recover delete Site Data tweet youtube ref relref vimeo instagram gist figure innershortcode" };
|
||||
return { aliases: ["golang","hugo"], k: t, i: "</", c: [e.CLCM, e.CBCM, { cN: "string", v: [e.QSM, { b: "'", e: "[^\\\\]'" }, { b: "`", e: "`" }] }, { cN: "number", v: [{ b: e.CNR + "[dflsi]", r: 1 }, e.CNM] }, { b: /:=/ }, { cN: "function", bK: "func", e: /\s*\{/, eE: !0, c: [e.TM, { cN: "params", b: /\(/, e: /\)/, k: t, i: /["']/ }] }] }
|
||||
});
|
||||
|
||||
hljs.initHighlightingOnLoad();
|
||||
@@ -4083,7 +4083,7 @@ img { max-width: 100%; }
|
||||
max-width: 30em;
|
||||
}
|
||||
.measure-wide-l {
|
||||
max-width: 40em;
|
||||
max-width: 34em;
|
||||
}
|
||||
.measure-narrow-l {
|
||||
max-width: 20em;
|
||||
@@ -4768,11 +4768,6 @@ h6:hover .header-link {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
pre, .pre {
|
||||
overflow-x: auto;
|
||||
overflow-y: hidden;
|
||||
overflow: scroll;
|
||||
}
|
||||
code {
|
||||
padding: 0.2em;
|
||||
margin: 0;
|
||||
@@ -4780,7 +4775,7 @@ code {
|
||||
background-color: rgba(27, 31, 35, .05);
|
||||
border-radius: 3px;
|
||||
}
|
||||
pre code {
|
||||
pre code {
|
||||
display: block;
|
||||
padding: 1.5em 1.5em;
|
||||
font-size: .875rem;
|
||||
@@ -4992,7 +4987,7 @@ dd {
|
||||
font-size: calc(0.70833rem + 0.83333vw);
|
||||
}
|
||||
}
|
||||
/* From http://cssfontstack.com */
|
||||
/* From https://www.cssfontstack.com */
|
||||
code, .code, pre code, .highlight pre {
|
||||
font-family: 'inconsolata',Menlo,Monaco,'Courier New',monospace;
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
+17
-14
@@ -1,19 +1,22 @@
|
||||
[[banners]]
|
||||
name = "Linode"
|
||||
link = "https://www.linode.com/"
|
||||
logo = "/images/sponsors/linode-logo_standard_light_medium.png"
|
||||
copy = ""
|
||||
name = "Linode"
|
||||
link = "https://www.linode.com/"
|
||||
logo = "/images/sponsors/linode-logo_standard_light_medium.png"
|
||||
utm_campaign = "hugosponsor"
|
||||
|
||||
[[banners]]
|
||||
name = "eSolia"
|
||||
link = "https://esolia.com/post/why-did-esolia-choose-hugo/"
|
||||
logo = "/images/sponsors/esolia-logo.svg"
|
||||
copy = ""
|
||||
|
||||
name = "eSolia"
|
||||
link = "https://esolia.com/post/why-did-esolia-choose-hugo/"
|
||||
logo = "/images/sponsors/esolia-logo.svg"
|
||||
utm_campaign = "hugosponsor"
|
||||
|
||||
[[banners]]
|
||||
name = "Brave"
|
||||
link = "https://brave.com/"
|
||||
logo = "/images/sponsors/brave-logo.svg"
|
||||
bgcolor = "#5A2FA1"
|
||||
copy = ""
|
||||
name = "ButterCMS"
|
||||
link = "https://buttercms.com/hugo-cms/"
|
||||
logo = "/images/sponsors/butter-light.svg"
|
||||
utm_campaign = "sponsorship"
|
||||
bgcolor = "#131A3E"
|
||||
|
||||
#hugohome
|
||||
#hugofooter
|
||||
#hugogithub
|
||||
|
||||
@@ -70,14 +70,6 @@
|
||||
{{ partial "hooks/before-body-end" . }}
|
||||
|
||||
|
||||
{{ if .Page.Store.Get "hasMermaid" }}
|
||||
<script src="https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js"></script>
|
||||
<script>
|
||||
mermaid.initialize({ startOnLoad: true });
|
||||
</script>
|
||||
{{ end }}
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
||||
Generated
+34
-31
@@ -1,38 +1,41 @@
|
||||
{{$classes_box := "ba b--dark-gray bg-light-gray br3 flex flex-column flex-wrap items-center justify-center ph3 pv4 mb4 w-100 w-30-l "}}
|
||||
{{$gtag := .gtag | default "unknown" }}
|
||||
{{ $classes_box := "ba b--dark-gray bg-light-gray br3 flex flex-column flex-wrap items-center justify-center ph3 pv4 mb4 w-100 w-30-l " }}
|
||||
{{ $gtag := .gtag | default "unknown" }}
|
||||
{{ $classes_box := "ba b--dark-gray bg-light-gray br3 flex flex-column flex-wrap items-center justify-center ph3 pv4 mb4 w-100 w-30-l " }}
|
||||
{{ $gtag := .gtag | default "unknown" }}
|
||||
{{ $utmSource := cond (eq $gtag "footer") "hugofooter" "hugohome" }}
|
||||
{{ with .cx.Site.Data.sponsors }}
|
||||
<section class="{{ $.classes_section | default "bg-primary-color-dark b--dark-gray bb bt ph5 pv4 w-100"}}">
|
||||
<div class="center mw9">
|
||||
<section
|
||||
class="{{ $.classes_section | default "bg-primary-color-dark b--dark-gray bb bt ph5 pv4 w-100" }}">
|
||||
<div class="center mw9">
|
||||
<h3 class="b f3 mv0 light-gray">Hugo Sponsors</h3>
|
||||
<div class="flex-ns flex-wrap center justify-between pt3">
|
||||
{{ range .banners }}
|
||||
{{ $banner := . }}
|
||||
{{if .logo}}
|
||||
<div class="{{$classes_box}} o-100"{{ with .bgcolor }} style="background-color: {{ . }};"{{ end}}>
|
||||
{{with .link -}}
|
||||
{{ $url := printf "%s?%s" . (querify "utm_source" "homepage" "utm_medium" "banner" "utm_campaign" "hugosponsor") | safeURL }}
|
||||
{{ if eq (getenv "HUGO_ENV") "production" | or (eq $.cx.Site.Params.env "production") }}
|
||||
{{ $gtagID := printf "Sponsor %s %s" $banner.name $gtag | title }}
|
||||
<a href="{{ $url }}" onclick="trackOutboundLink({{ printf "'%s', '%s'" $gtagID $url | safeJS }});" class="grow">
|
||||
{{ else }}
|
||||
<a href="{{ $url }}" class="grow">
|
||||
{{ end }}
|
||||
{{- end}}
|
||||
<img src="{{ .logo }}" alt="Logo for {{ .name }}" class="img h3 center" />
|
||||
{{with .link}}</a>{{end}}
|
||||
{{with .copy}}
|
||||
<p class="center lh-copy gray mv1 tc {{$.classes_copy | default "f5 w-70-ns"}}">
|
||||
{{- . -}}
|
||||
</p>
|
||||
{{end}}
|
||||
</div>
|
||||
{{else}}
|
||||
<div class="{{$classes_box}} o-10">
|
||||
<p class="b black tc">Your Logo Here</p>
|
||||
</div>
|
||||
{{end}}
|
||||
{{end}}
|
||||
<div
|
||||
class="{{ $classes_box }} o-100"
|
||||
{{ with .bgcolor }}style="background-color: {{ . }};"{{ end }}>
|
||||
{{ $url := printf "%s?%s" .link (querify "utm_source" $utmSource "utm_medium" "banner" "utm_campaign" (.utm_campaign | default "hugosponsor")) | safeURL }}
|
||||
{{ if eq (getenv "HUGO_ENV") "production" | or (eq $.cx.Site.Params.env "production") }}
|
||||
{{ $gtagID := printf "Sponsor %s %s" .name $gtag | title }}
|
||||
<a
|
||||
href="{{ $url }}"
|
||||
onclick="trackOutboundLink({{ printf "'%s', '%s'" $gtagID $url | safeJS }});"
|
||||
class="grow">
|
||||
<img
|
||||
src="{{ .logo }}"
|
||||
alt="Logo for {{ .name }}"
|
||||
class="img h3 center" />
|
||||
</a>
|
||||
{{ else }}
|
||||
<a href="{{ $url }}" class="grow">
|
||||
<img
|
||||
src="{{ .logo }}"
|
||||
alt="Logo for {{ .name }}"
|
||||
class="img h3 center"
|
||||
/></a>
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
{{end}}
|
||||
{{ end }}
|
||||
|
||||
+5
-13
@@ -3,14 +3,7 @@
|
||||
"version": "1.1.0",
|
||||
"description": "Default Theme for Hugo Sites",
|
||||
"main": "index.js",
|
||||
"homepage": "https://gohugo.io/",
|
||||
"bugs": {
|
||||
"url": "https://github.com/gohugoio/gohugoioTheme/issues"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/gohugoio/gohugoioTheme.git"
|
||||
},
|
||||
"repository": "",
|
||||
"author": "budparr",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
@@ -21,14 +14,13 @@
|
||||
"devDependencies": {
|
||||
"clean-webpack-plugin": "^1.0.0",
|
||||
"clipboard": "^2.0.4",
|
||||
"css-loader": "^4.3.0",
|
||||
"css-loader": "^1.0.1",
|
||||
"docsearch.js": "^2.6.1",
|
||||
"file-loader": "^2.0.0",
|
||||
"glob-all": "^3.1.0",
|
||||
"highlight.js": "^9.13.1",
|
||||
"lazysizes": "^5.2.1",
|
||||
"lazysizes": "^4.1.4",
|
||||
"mini-css-extract-plugin": "^0.4.4",
|
||||
"postcss": "^7.0.36",
|
||||
"postcss": "^7.0.5",
|
||||
"postcss-cssnext": "^3.1.0",
|
||||
"postcss-import": "^12.0.1",
|
||||
"postcss-loader": "^3.0.0",
|
||||
@@ -36,7 +28,7 @@
|
||||
"scrolldir": "^1.4.0",
|
||||
"tachyons": "^4.7.0",
|
||||
"typeface-muli": "0.0.54",
|
||||
"webpack": "^4.44.1",
|
||||
"webpack": "^4.25.1",
|
||||
"webpack-command": "^0.4.2"
|
||||
},
|
||||
"dependencies": {}
|
||||
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
<svg width="158" height="160" viewBox="0 0 158 160" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M4.32 103V27.64H17.664V54.616C18.752 54.04 20 53.56 21.408 53.176C22.816 52.728 24.192 52.376 25.536 52.12C26.88 51.864 28.192 51.672 29.472 51.544C30.816 51.352 32.032 51.256 33.12 51.256C35.872 51.256 38.24 51.704 40.224 52.6C42.272 53.432 43.904 54.584 45.12 56.056C46.336 57.464 47.296 59.32 48 61.624C48.704 63.928 49.152 66.328 49.344 68.824C49.6 71.32 49.728 74.296 49.728 77.752C49.728 86.008 48.448 92.376 45.888 96.856C43.328 101.336 39.072 103.576 33.12 103.576C30.368 103.576 27.584 103 24.768 101.848C21.952 100.696 19.616 99.352 17.76 97.816L15.36 103H4.32ZM17.76 88.984C21.024 91.032 24.992 92.056 29.664 92.056C31.136 92.056 32.352 91.64 33.312 90.808C34.272 89.912 35.008 88.376 35.52 86.2C36.032 83.96 36.288 80.984 36.288 77.272C36.288 73.048 36 69.784 35.424 67.48C34.912 65.176 34.208 63.672 33.312 62.968C32.416 62.2 31.2 61.816 29.664 61.816C27.296 61.816 25.152 61.976 23.232 62.296C21.312 62.552 19.488 63.032 17.76 63.736V88.984ZM56.8958 77.272C56.8958 72.856 57.1518 69.176 57.6638 66.232C58.2398 63.224 59.0398 60.76 60.0638 58.84C61.0878 56.856 62.5278 55.352 64.3838 54.328C66.2398 53.304 68.2878 52.6 70.5278 52.216C72.8318 51.832 75.7118 51.64 79.1678 51.64C81.4718 51.64 83.4238 51.704 85.0238 51.832C86.6238 51.896 88.2238 52.088 89.8238 52.408C91.4878 52.664 92.8318 53.08 93.8558 53.656C94.8798 54.168 95.8718 54.904 96.8318 55.864C97.7918 56.76 98.5278 57.88 99.0398 59.224C99.6158 60.504 100.032 62.072 100.288 63.928C100.608 65.72 100.768 67.8 100.768 70.168C100.768 74.648 99.5838 77.912 97.2158 79.96C94.8478 82.008 91.2958 83.032 86.5598 83.032H70.3358C70.3358 85.976 70.7518 88.184 71.5838 89.656C72.4798 91.064 73.5678 91.928 74.8478 92.248C76.1918 92.568 78.2718 92.728 81.0878 92.728C88.9598 92.728 95.1998 92.376 99.8078 91.672V100.792C95.0078 102.584 86.3038 103.48 73.6958 103.48C70.4318 103.48 67.7118 103 65.5358 102.04C63.4238 101.08 61.7278 99.512 60.4478 97.336C59.1678 95.16 58.2398 92.472 57.6638 89.272C57.1518 86.072 56.8958 82.072 56.8958 77.272ZM70.3358 73.336H83.1038C85.9198 73.336 87.3278 72.056 87.3278 69.496C87.3278 66.296 86.8798 64.248 85.9838 63.352C85.1518 62.392 83.1358 61.912 79.9358 61.912C77.8878 61.912 76.3518 62.008 75.3278 62.2C74.3678 62.328 73.4078 62.776 72.4478 63.544C71.5518 64.248 70.9438 65.368 70.6238 66.904C70.3678 68.44 70.2718 70.584 70.3358 73.336ZM108.101 128.92V52.024H119.141L121.445 57.112C123.301 55.64 125.637 54.328 128.453 53.176C131.333 52.024 134.149 51.448 136.901 51.448C139.397 51.448 141.573 51.864 143.429 52.696C145.349 53.528 146.917 54.68 148.133 56.152C149.413 57.624 150.469 59.448 151.301 61.624C152.133 63.8 152.709 66.168 153.029 68.728C153.349 71.288 153.509 74.136 153.509 77.272C153.509 79.896 153.413 82.264 153.221 84.376C153.093 86.488 152.805 88.6 152.357 90.712C151.909 92.76 151.269 94.552 150.437 96.088C149.669 97.624 148.677 99 147.461 100.216C146.309 101.368 144.837 102.264 143.045 102.904C141.253 103.48 139.205 103.768 136.901 103.768C134.597 103.768 132.005 103.48 129.125 102.904C126.245 102.264 123.685 101.464 121.445 100.504V128.92H108.101ZM121.445 91.288C124.773 92.568 128.773 93.208 133.445 93.208C134.981 93.208 136.197 92.856 137.093 92.152C137.989 91.384 138.693 89.848 139.205 87.544C139.781 85.24 140.069 82.008 140.069 77.848C140.069 72.344 139.525 68.504 138.437 66.328C137.349 64.088 135.685 62.968 133.445 62.968C128.709 62.968 124.709 63.992 121.445 66.04V91.288Z" fill="white"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 3.5 KiB |
-1
File diff suppressed because one or more lines are too long
|
Before Width: | Height: | Size: 5.6 KiB |
+1
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 402 58"><g fill="#231F20"><path d="M24.6 23c.4 0 .7-.1 1-.2l10-5.4c1-.5 1.3-1.8.8-2.8-.5-1-1.8-1.3-2.8-.8l-9.9 5.4c-1 .3-1.5 1.3-1.3 2.3.3 1 1.3 1.7 2.3 1.5h-.1zM39.8 30.9c.3 0 .7-.1 1-.3L56.7 22c.6-.3 1-1 1-1.7 0-.8-.3-1.5-.9-1.8-.7-.4-1.4-.4-2.1-.1L38.8 27c-.9.4-1.5 1.4-1.2 2.4.2 1 1.2 1.6 2.2 1.5z"/><path d="M81 19.6c-.4-1.2-1.3-2.2-2.4-2.7L61.4 7.7c-2.8-1.4-6.1-1.4-9 0l-1.4.7L39.1 2C36.3.6 33 .6 30.1 2L2.5 16.9c-1.4.6-2.3 1.9-2.5 3.4v15.2c0 .8.4 1.5 1.1 1.8l35 19c2.8 1.4 6.2 1.4 9 0L80 37.1c.7-.3 1.1-1 1.1-1.8v-15c0-.2-.1-.5-.1-.7zm-76.5.9L32 5.6c1.6-.7 3.5-.7 5.2 0L51 13l3.3-1.8c1.7-.7 3.6-.7 5.2 0l17.1 9.2.2.1-.2.1-33.4 18c-1.7.8-3.6.8-5.2 0l-33.5-18-.2-.1h.2zm38.6 32.2c-1.6.7-3.5.7-5.1 0L4.1 34.3v-9.2L36 42.3c2.8 1.4 6.2 1.4 9 0l32-17.2v9L43.1 52.7zM115.7 10.2h18.2c8.7 0 13.1 3.1 13.1 9.1 0 1.9-.5 3.7-1.6 5.2s-2.6 2.6-4.3 3.2c2.2.4 4.2 1.5 5.7 3.1s2.2 3.6 2.2 5.7c0 3.8-1.4 6.7-4.1 8.7-2.7 2-6.6 3-11.8 3h-17.5v-5.4l1.8-.2c.4 0 .8-.2 1.1-.5.2-.4.3-.9.3-1.3V16.1l-3.1-.3v-5.6zm13.1 6.4v9h2.7c3.5 0 5.3-1.6 5.3-4.8 0-2.8-1.7-4.2-5.1-4.2h-2.9zm0 15.1v9.9h3.7c3.8 0 5.8-1.8 5.8-5.2 0-3.1-1.9-4.7-5.7-4.7h-3.8zM180.7 19v22c0 .5 0 .9.3 1.3.2.3.6.4 1 .5l1.5.1v5.2h-11.7v-3.6h-.2c-1.7 3-4.5 4.4-8.5 4.4-3.1 0-5.3-.8-6.8-2.3-1.4-1.6-2.1-4-2.1-7.3V26.2c0-.4-.1-.8-.4-1.1-.2-.3-.6-.5-1-.5l-1.6-.2V19H164v18.4c-.1 1.1.1 2.2.6 3.1.6.8 1.6 1.1 2.5 1 1.1.1 2.2-.4 2.9-1.2.7-1 1.1-2.2 1-3.4V26.3c0-.5-.1-.9-.3-1.3-.3-.3-.7-.4-1.1-.4l-1.3-.2V19h12.4zM198.9 12.3V19h8.1c2.5-1.1 4.3-3.4 5.5-6.7h5.3V19h6.9l-.5 6.3h-6.4v12.3c-.1 1.1.2 2.2.7 3.2.4.5 1.3.8 2.7.8 1.2 0 2.5-.3 3.6-.8l1.4 6.3c-2.5 1.3-5.2 1.9-7.9 1.8-1.3 0-2.5-.1-3.8-.3-.9-.2-1.8-.4-2.7-.8-.7-.3-1.3-.8-1.8-1.4-.4-.5-.8-1-1.1-1.6-.3-.6-.5-1.3-.6-2-.1-.6-.2-1.3-.3-2V25.3h-9v12.3c-.1 1 .1 2.1.6 3.1.5.7 1.4 1.1 2.3 1 1.1 0 2.2-.3 3.2-.8l1.7 6.2c-2.3 1.2-4.9 1.9-7.5 1.8-3.7 0-6.4-.9-7.9-2.6-1.5-1.7-2.3-4.2-2.3-7.6V25.3h-3.9l.8-5.5c3.6-.8 6.2-3.3 7.6-7.4l5.3-.1zM242.7 18.2c2.7-.1 5.3.6 7.5 2.2 2 1.6 3 4.1 2.8 6.6 0 6.9-5.3 10.2-16 10 .1 1.3.7 2.6 1.7 3.5 1.2 1 2.7 1.4 4.2 1.4 2.6-.1 5.2-.9 7.4-2.3l2.6 6.3c-.5.4-1 .7-1.6.9-1.3.6-2.6 1-4 1.4-1.9.5-3.8.7-5.7.7-4.9 0-8.5-1.3-10.8-4-2.3-2.6-3.5-6.2-3.5-10.7-.1-4.1 1.3-8.2 4-11.4 2.7-3 6.5-4.6 11.4-4.6zm2 9.3c0-.7-.2-1.4-.7-1.9-.5-.5-1.2-.7-1.9-.6-1.4 0-2.8.6-3.6 1.8-1 1.3-1.6 2.9-1.6 4.6 5.2.2 7.7-1.2 7.7-3.9h.1zM272.5 25.5c-1.1 0-2.1.5-2.7 1.3-.7.9-1.1 2.1-1 3.3v12.5l5.1.3v5.3h-18.1V43l1.9-.2c.4.1.8-.1 1.1-.4.2-.4.3-.9.3-1.4V26.2c0-.4-.1-.8-.3-1.2-.3-.3-.6-.4-1-.4l-2-.2V19H268v4.4h.1c.7-1.4 1.7-2.7 3-3.6 1.6-1.1 3.5-1.7 5.4-1.6 1.9-.1 3.7.2 5.4.9v11.3l-7.6.4v-3.9c0-.7-.2-1.1-.5-1.2-.4-.1-.9-.2-1.3-.2zM308.7 17.5c-1.2-.3-2.3-.4-3.4-.4-6.1 0-9.2 3.9-9.2 11.8 0 3.8.8 6.8 2.3 9 1.5 2.2 3.9 3.3 7.1 3.4 1.1 0 2.1-.1 3.2-.4.6-.2 1-.8 1-1.5v-3.7l7.3.4v10.5c-3.8 1.7-7.9 2.5-12.1 2.3-6.1 0-10.8-1.6-14.1-4.9-3.3-3.3-5-8.1-5-14.5 0-3.2.5-6.4 1.6-9.4.9-2.5 2.4-4.6 4.4-6.3 1.8-1.4 3.8-2.5 6-3.3 2.2-.7 4.6-1 6.9-1 4.2-.1 8.3.7 12.2 2.4v10l-7.4.4V19c0-.9-.3-1.4-.8-1.5zM323.6 10.2h14.6l7.5 24.8h.2l7.7-24.7h14.6v5.4l-1.8.2c-.5 0-.9.2-1.2.5-.3.4-.4.9-.3 1.3l1.9 24.8 2.9.1v5.6h-15.3v-5.5l1.8-.2c.4.1.8-.1 1-.4.2-.4.3-.9.2-1.3l-.9-16.1h-.1l-7.2 23.5h-7.1l-7-23.1h-.2l-1 17.3 2.8.2v5.6h-15.3v-5.5l1.8-.2c.5 0 .9-.2 1.2-.5.2-.4.4-.9.4-1.4l2-24.6-3.2-.2v-5.6zM385.5 41.6c3.5 0 5.3-1.4 5.3-4.2 0-1.1-.5-2.2-1.4-2.8-1.4-.8-2.9-1.4-4.5-1.8-1.3-.3-2.7-.8-4-1.3-1.2-.5-2.3-1.2-3.4-1.9-1.2-.9-2.2-2-2.8-3.3-.6-1.5-1-3.2-1-4.8-.1-3.4 1.4-6.7 4-8.8 2.7-2.1 6.2-3.1 10.6-3.1 4-.2 8 .6 11.7 2.2v9.3l-7.4.5v-2.9c0-.8-.3-1.3-.8-1.4-1.1-.3-2.2-.4-3.3-.4-1.1 0-2.2.3-3.1.8-.8.6-1.3 1.6-1.2 2.6-.1 1.1.5 2.2 1.4 2.8 1.5.9 3.1 1.6 4.8 2 1.4.4 2.5.8 3.3 1.1.9.4 1.9.8 2.8 1.3 1 .5 1.9 1.2 2.6 2 .7.9 1.2 1.8 1.6 2.9.5 1.3.7 2.6.7 4 .2 3.6-1.3 7-4.1 9.3-2.7 2.2-6.4 3.3-11.2 3.3-4.3.1-8.6-.7-12.6-2.3v-9.8l7.5-.5v3.2c0 .9.3 1.4.9 1.6 1.1.2 2.3.4 3.6.4z"/></g></svg>
|
||||
|
After Width: | Height: | Size: 3.8 KiB |
+1
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 402 58"><g fill="#fff"><path d="M24.6 23c.4 0 .7-.1 1-.2l10-5.4c1-.5 1.3-1.8.8-2.8-.5-1-1.8-1.3-2.8-.8l-9.9 5.4c-1 .3-1.5 1.3-1.3 2.3.3 1 1.3 1.7 2.3 1.5h-.1zM39.8 30.9c.3 0 .7-.1 1-.3L56.7 22c.6-.3 1-1 1-1.7 0-.8-.3-1.5-.9-1.8-.7-.4-1.4-.4-2.1-.1L38.8 27c-.9.4-1.5 1.4-1.2 2.4.2 1 1.2 1.6 2.2 1.5z"/><path d="M81 19.6c-.4-1.2-1.3-2.2-2.4-2.7L61.4 7.7c-2.8-1.4-6.1-1.4-9 0l-1.4.7L39.1 2C36.3.6 33 .6 30.1 2L2.5 16.9c-1.4.6-2.3 1.9-2.5 3.4v15.2c0 .8.4 1.5 1.1 1.8l35 19c2.8 1.4 6.2 1.4 9 0L80 37.1c.7-.3 1.1-1 1.1-1.8v-15c0-.2-.1-.5-.1-.7zm-76.5.9L32 5.6c1.6-.7 3.5-.7 5.2 0L51 13l3.3-1.8c1.7-.7 3.6-.7 5.2 0l17.1 9.2.2.1-.2.1-33.4 18c-1.7.8-3.6.8-5.2 0l-33.5-18-.2-.1h.2zm38.6 32.2c-1.6.7-3.5.7-5.1 0L4.1 34.3v-9.2L36 42.3c2.8 1.4 6.2 1.4 9 0l32-17.2v9L43.1 52.7zM115.7 10.2h18.2c8.7 0 13.1 3.1 13.1 9.1 0 1.9-.5 3.7-1.6 5.2s-2.6 2.6-4.3 3.2c2.2.4 4.2 1.5 5.7 3.1s2.2 3.6 2.2 5.7c0 3.8-1.4 6.7-4.1 8.7-2.7 2-6.6 3-11.8 3h-17.5v-5.4l1.8-.2c.4 0 .8-.2 1.1-.5.2-.4.3-.9.3-1.3V16.1l-3.1-.3v-5.6zm13.1 6.4v9h2.7c3.5 0 5.3-1.6 5.3-4.8 0-2.8-1.7-4.2-5.1-4.2h-2.9zm0 15.1v9.9h3.7c3.8 0 5.8-1.8 5.8-5.2 0-3.1-1.9-4.7-5.7-4.7h-3.8zM180.7 19v22c0 .5 0 .9.3 1.3.2.3.6.4 1 .5l1.5.1v5.2h-11.7v-3.6h-.2c-1.7 3-4.5 4.4-8.5 4.4-3.1 0-5.3-.8-6.8-2.3-1.4-1.6-2.1-4-2.1-7.3V26.2c0-.4-.1-.8-.4-1.1-.2-.3-.6-.5-1-.5l-1.6-.2V19H164v18.4c-.1 1.1.1 2.2.6 3.1.6.8 1.6 1.1 2.5 1 1.1.1 2.2-.4 2.9-1.2.7-1 1.1-2.2 1-3.4V26.3c0-.5-.1-.9-.3-1.3-.3-.3-.7-.4-1.1-.4l-1.3-.2V19h12.4zM198.9 12.3V19h8.1c2.5-1.1 4.3-3.4 5.5-6.7h5.3V19h6.9l-.5 6.3h-6.4v12.3c-.1 1.1.2 2.2.7 3.2.4.5 1.3.8 2.7.8 1.2 0 2.5-.3 3.6-.8l1.4 6.3c-2.5 1.3-5.2 1.9-7.9 1.8-1.3 0-2.5-.1-3.8-.3-.9-.2-1.8-.4-2.7-.8-.7-.3-1.3-.8-1.8-1.4-.4-.5-.8-1-1.1-1.6-.3-.6-.5-1.3-.6-2-.1-.6-.2-1.3-.3-2V25.3h-9v12.3c-.1 1 .1 2.1.6 3.1.5.7 1.4 1.1 2.3 1 1.1 0 2.2-.3 3.2-.8l1.7 6.2c-2.3 1.2-4.9 1.9-7.5 1.8-3.7 0-6.4-.9-7.9-2.6-1.5-1.7-2.3-4.2-2.3-7.6V25.3h-3.9l.8-5.5c3.6-.8 6.2-3.3 7.6-7.4l5.3-.1zM242.7 18.2c2.7-.1 5.3.6 7.5 2.2 2 1.6 3 4.1 2.8 6.6 0 6.9-5.3 10.2-16 10 .1 1.3.7 2.6 1.7 3.5 1.2 1 2.7 1.4 4.2 1.4 2.6-.1 5.2-.9 7.4-2.3l2.6 6.3c-.5.4-1 .7-1.6.9-1.3.6-2.6 1-4 1.4-1.9.5-3.8.7-5.7.7-4.9 0-8.5-1.3-10.8-4-2.3-2.6-3.5-6.2-3.5-10.7-.1-4.1 1.3-8.2 4-11.4 2.7-3 6.5-4.6 11.4-4.6zm2 9.3c0-.7-.2-1.4-.7-1.9-.5-.5-1.2-.7-1.9-.6-1.4 0-2.8.6-3.6 1.8-1 1.3-1.6 2.9-1.6 4.6 5.2.2 7.7-1.2 7.7-3.9h.1zM272.5 25.5c-1.1 0-2.1.5-2.7 1.3-.7.9-1.1 2.1-1 3.3v12.5l5.1.3v5.3h-18.1V43l1.9-.2c.4.1.8-.1 1.1-.4.2-.4.3-.9.3-1.4V26.2c0-.4-.1-.8-.3-1.2-.3-.3-.6-.4-1-.4l-2-.2V19H268v4.4h.1c.7-1.4 1.7-2.7 3-3.6 1.6-1.1 3.5-1.7 5.4-1.6 1.9-.1 3.7.2 5.4.9v11.3l-7.6.4v-3.9c0-.7-.2-1.1-.5-1.2-.4-.1-.9-.2-1.3-.2zM308.7 17.5c-1.2-.3-2.3-.4-3.4-.4-6.1 0-9.2 3.9-9.2 11.8 0 3.8.8 6.8 2.3 9 1.5 2.2 3.9 3.3 7.1 3.4 1.1 0 2.1-.1 3.2-.4.6-.2 1-.8 1-1.5v-3.7l7.3.4v10.5c-3.8 1.7-7.9 2.5-12.1 2.3-6.1 0-10.8-1.6-14.1-4.9-3.3-3.3-5-8.1-5-14.5 0-3.2.5-6.4 1.6-9.4.9-2.5 2.4-4.6 4.4-6.3 1.8-1.4 3.8-2.5 6-3.3 2.2-.7 4.6-1 6.9-1 4.2-.1 8.3.7 12.2 2.4v10l-7.4.4V19c0-.9-.3-1.4-.8-1.5zM323.6 10.2h14.6l7.5 24.8h.2l7.7-24.7h14.6v5.4l-1.8.2c-.5 0-.9.2-1.2.5-.3.4-.4.9-.3 1.3l1.9 24.8 2.9.1v5.6h-15.3v-5.5l1.8-.2c.4.1.8-.1 1-.4.2-.4.3-.9.2-1.3l-.9-16.1h-.1l-7.2 23.5h-7.1l-7-23.1h-.2l-1 17.3 2.8.2v5.6h-15.3v-5.5l1.8-.2c.5 0 .9-.2 1.2-.5.2-.4.4-.9.4-1.4l2-24.6-3.2-.2v-5.6zM385.5 41.6c3.5 0 5.3-1.4 5.3-4.2 0-1.1-.5-2.2-1.4-2.8-1.4-.8-2.9-1.4-4.5-1.8-1.3-.3-2.7-.8-4-1.3-1.2-.5-2.3-1.2-3.4-1.9-1.2-.9-2.2-2-2.8-3.3-.6-1.5-1-3.2-1-4.8-.1-3.4 1.4-6.7 4-8.8 2.7-2.1 6.2-3.1 10.6-3.1 4-.2 8 .6 11.7 2.2v9.3l-7.4.5v-2.9c0-.8-.3-1.3-.8-1.4-1.1-.3-2.2-.4-3.3-.4-1.1 0-2.2.3-3.1.8-.8.6-1.3 1.6-1.2 2.6-.1 1.1.5 2.2 1.4 2.8 1.5.9 3.1 1.6 4.8 2 1.4.4 2.5.8 3.3 1.1.9.4 1.9.8 2.8 1.3 1 .5 1.9 1.2 2.6 2 .7.9 1.2 1.8 1.6 2.9.5 1.3.7 2.6.7 4 .2 3.6-1.3 7-4.1 9.3-2.7 2.2-6.4 3.3-11.2 3.3-4.3.1-8.6-.7-12.6-2.3v-9.8l7.5-.5v3.2c0 .9.3 1.4.9 1.6 1.1.2 2.3.4 3.6.4z"/></g></svg>
|
||||
|
After Width: | Height: | Size: 3.8 KiB |
Generated
-1
File diff suppressed because one or more lines are too long
|
Before Width: | Height: | Size: 6.7 KiB |
+4
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 8.0 KiB |
@@ -1 +1 @@
|
||||
# github.com/gohugoio/gohugoioTheme v0.0.0-20220228085601-7cfbda06d135
|
||||
# github.com/gohugoio/gohugoioTheme v0.0.0-20221116211530-5ae8dcdd68d6
|
||||
|
||||
@@ -1,80 +0,0 @@
|
||||
baseURL = "https://gohugo.io/"
|
||||
paginate = 100
|
||||
defaultContentLanguage = "en"
|
||||
enableEmoji = true
|
||||
timeZone = "Europe/Oslo"
|
||||
# Set the unicode character used for the "return" link in page footnotes.
|
||||
footnotereturnlinkcontents = "↩"
|
||||
languageCode = "en-us"
|
||||
title = "Hugo"
|
||||
|
||||
ignoreErrors = ["error-remote-getjson", "error-missing-instagram-accesstoken"]
|
||||
|
||||
|
||||
googleAnalytics = "UA-7131036-4"
|
||||
|
||||
pluralizeListTitles = false
|
||||
|
||||
# We do redirects via Netlify's _redirects file, generated by Hugo (see "outputs" below).
|
||||
disableAliases = true
|
||||
|
||||
[minify]
|
||||
[minify.tdewolff]
|
||||
[minify.tdewolff.css]
|
||||
[minify.tdewolff.html]
|
||||
keepWhitespace = true
|
||||
|
||||
[module]
|
||||
[module.hugoVersion]
|
||||
min = "0.56.0"
|
||||
[[module.imports]]
|
||||
path = "github.com/gohugoio/gohugoioTheme"
|
||||
|
||||
[outputs]
|
||||
home = [ "HTML", "RSS", "REDIR", "HEADERS" ]
|
||||
section = [ "HTML", "RSS"]
|
||||
|
||||
[mediaTypes]
|
||||
[mediaTypes."text/netlify"]
|
||||
delimiter = ""
|
||||
|
||||
[outputFormats]
|
||||
[outputFormats.REDIR]
|
||||
mediatype = "text/netlify"
|
||||
baseName = "_redirects"
|
||||
isPlainText = true
|
||||
notAlternative = true
|
||||
[outputFormats.HEADERS]
|
||||
mediatype = "text/netlify"
|
||||
baseName = "_headers"
|
||||
isPlainText = true
|
||||
notAlternative = true
|
||||
|
||||
[related]
|
||||
|
||||
threshold = 80
|
||||
includeNewer = true
|
||||
toLower = false
|
||||
|
||||
[[related.indices]]
|
||||
name = "keywords"
|
||||
weight = 100
|
||||
[[related.indices]]
|
||||
name = "date"
|
||||
weight = 10
|
||||
pattern = "2006"
|
||||
|
||||
[social]
|
||||
twitter = "GoHugoIO"
|
||||
|
||||
|
||||
[imaging]
|
||||
# See https://github.com/disintegration/imaging
|
||||
# CatmullRom is a sharp bicubic filter which should fit the docs site well with its many screenshots.
|
||||
# Note that you can also set this per image processing.
|
||||
resampleFilter = "CatmullRom"
|
||||
|
||||
# Default JPEG quality setting. Default is 75.
|
||||
quality = 75
|
||||
|
||||
anchor = "smart"
|
||||
@@ -1,19 +1,28 @@
|
||||
baseURL = "https://gohugo.io/"
|
||||
paginate = 100
|
||||
defaultContentLanguage = "en"
|
||||
enableEmoji = true
|
||||
# Set the unicode character used for the "return" link in page footnotes.
|
||||
footnotereturnlinkcontents = "↩"
|
||||
languageCode = "en-us"
|
||||
title = "Hugo"
|
||||
|
||||
googleAnalytics = "UA-7131036-4"
|
||||
|
||||
ignoreErrors = ["error-remote-getjson", "error-missing-instagram-accesstoken"]
|
||||
languageCode = "en-us"
|
||||
paginate = 100
|
||||
pluralizeListTitles = false
|
||||
timeZone = "Europe/Oslo"
|
||||
title = "Hugo"
|
||||
|
||||
# We do redirects via Netlify's _redirects file, generated by Hugo (see "outputs" below).
|
||||
disableAliases = true
|
||||
|
||||
[minify]
|
||||
[minify.tdewolff]
|
||||
[minify.tdewolff.html]
|
||||
keepWhitespace = true
|
||||
|
||||
[module]
|
||||
[module.hugoVersion]
|
||||
min = "0.56.0"
|
||||
[[module.imports]]
|
||||
path = "github.com/gohugoio/gohugoioTheme"
|
||||
|
||||
[outputs]
|
||||
home = [ "HTML", "RSS", "REDIR", "HEADERS" ]
|
||||
section = [ "HTML", "RSS"]
|
||||
@@ -48,13 +57,10 @@ maxAge = "1440h"
|
||||
dir = ":resourceDir/_gen"
|
||||
maxAge = -1
|
||||
|
||||
|
||||
[related]
|
||||
|
||||
threshold = 80
|
||||
includeNewer = true
|
||||
toLower = false
|
||||
|
||||
[[related.indices]]
|
||||
name = "keywords"
|
||||
weight = 100
|
||||
@@ -66,25 +72,13 @@ pattern = "2006"
|
||||
[social]
|
||||
twitter = "GoHugoIO"
|
||||
|
||||
|
||||
# MARKDOWN
|
||||
## Configuration for BlackFriday markdown parser: https://github.com/russross/blackfriday
|
||||
[blackfriday]
|
||||
plainIDAnchors = true
|
||||
# See https://github.com/gohugoio/hugo/issues/2424
|
||||
hrefTargetBlank = false
|
||||
angledQuotes = false
|
||||
latexDashes = true
|
||||
|
||||
[imaging]
|
||||
# See https://github.com/disintegration/imaging
|
||||
# CatmullRom is a sharp bicubic filter which should fit the docs site well with its many screenshots.
|
||||
# Note that you can also set this per image processing.
|
||||
resampleFilter = "CatmullRom"
|
||||
|
||||
# Default JPEG quality setting. Default is 75.
|
||||
quality = 75
|
||||
|
||||
anchor = "smart"
|
||||
|
||||
[taxonomies]
|
||||
|
||||
@@ -1,114 +1,102 @@
|
||||
[[docs]]
|
||||
name = "About Hugo"
|
||||
weight = 1
|
||||
weight = 10
|
||||
identifier = "about"
|
||||
url = "/about/"
|
||||
|
||||
[[docs]]
|
||||
name = "Installation"
|
||||
weight = 20
|
||||
identifier = "installation"
|
||||
url = "/installation/"
|
||||
|
||||
[[docs]]
|
||||
name = "Getting Started"
|
||||
weight = 5
|
||||
weight = 30
|
||||
identifier = "getting-started"
|
||||
url = "/getting-started/"
|
||||
|
||||
[[docs]]
|
||||
name = "Hugo Modules"
|
||||
weight = 15
|
||||
weight = 40
|
||||
identifier = "modules"
|
||||
post = "break"
|
||||
url = "/hugo-modules/"
|
||||
|
||||
# Core Menus
|
||||
# Core menus
|
||||
|
||||
[[docs]]
|
||||
name = "Content Management"
|
||||
weight = 20
|
||||
weight = 50
|
||||
identifier = "content-management"
|
||||
post = "expanded"
|
||||
url = "/content-management/"
|
||||
|
||||
[[docs]]
|
||||
name = "Templates"
|
||||
weight = 25
|
||||
weight = 60
|
||||
identifier = "templates"
|
||||
|
||||
url = "/templates/"
|
||||
|
||||
[[docs]]
|
||||
name = "Functions"
|
||||
weight = 30
|
||||
weight = 70
|
||||
identifier = "functions"
|
||||
url = "/functions/"
|
||||
|
||||
[[docs]]
|
||||
name = "Variables"
|
||||
weight = 35
|
||||
weight = 80
|
||||
identifier = "variables"
|
||||
url = "/variables/"
|
||||
|
||||
[[docs]]
|
||||
name = "Hugo Pipes"
|
||||
weight = 36
|
||||
weight = 90
|
||||
identifier = "pipes"
|
||||
url = "/hugo-pipes/"
|
||||
|
||||
[[docs]]
|
||||
name = "CLI"
|
||||
weight = 40
|
||||
weight = 100
|
||||
post = "break"
|
||||
identifier = "commands"
|
||||
url = "/commands/"
|
||||
|
||||
|
||||
|
||||
# LOW LEVEL ITEMS
|
||||
|
||||
# Low level items
|
||||
|
||||
[[docs]]
|
||||
name = "Troubleshooting"
|
||||
weight = 60
|
||||
weight = 110
|
||||
identifier = "troubleshooting"
|
||||
url = "/troubleshooting/"
|
||||
|
||||
[[docs]]
|
||||
name = "Tools"
|
||||
weight = 70
|
||||
weight = 120
|
||||
identifier = "tools"
|
||||
url = "/tools/"
|
||||
|
||||
[[docs]]
|
||||
name = "Hosting & Deployment"
|
||||
weight = 80
|
||||
weight = 130
|
||||
identifier = "hosting-and-deployment"
|
||||
url = "/hosting-and-deployment/"
|
||||
|
||||
[[docs]]
|
||||
name = "Contribute"
|
||||
weight = 100
|
||||
weight = 140
|
||||
post = "break"
|
||||
identifier = "contribute"
|
||||
url = "/contribute/"
|
||||
|
||||
#[[docs]]
|
||||
# name = "Tags"
|
||||
# weight = 120
|
||||
# identifier = "tags"
|
||||
# url = "/tags/"
|
||||
|
||||
|
||||
# [[docs]]
|
||||
# name = "Categories"
|
||||
# weight = 140
|
||||
# identifier = "categories"
|
||||
# url = "/categories/"
|
||||
|
||||
######## QUICKLINKS
|
||||
|
||||
[[quicklinks]]
|
||||
name = "Fundamentals"
|
||||
weight = 1
|
||||
identifier = "fundamentals"
|
||||
url = "/tags/fundamentals/"
|
||||
|
||||
|
||||
|
||||
[[quicklinks]]
|
||||
name = "Fundamentals"
|
||||
weight = 1
|
||||
identifier = "fundamentals"
|
||||
url = "/tags/fundamentals/"
|
||||
|
||||
######## GLOBAL ITEMS TO BE SHARED WITH THE HUGO SITES
|
||||
|
||||
@@ -118,37 +106,37 @@
|
||||
identifier = "news"
|
||||
url = "/news/"
|
||||
|
||||
[[global]]
|
||||
name = "Docs"
|
||||
weight = 5
|
||||
identifier = "docs"
|
||||
url = "/documentation/"
|
||||
[[global]]
|
||||
name = "Docs"
|
||||
weight = 5
|
||||
identifier = "docs"
|
||||
url = "/documentation/"
|
||||
|
||||
[[global]]
|
||||
name = "Themes"
|
||||
weight = 10
|
||||
identifier = "themes"
|
||||
url = "https://themes.gohugo.io/"
|
||||
[[global]]
|
||||
name = "Themes"
|
||||
weight = 10
|
||||
identifier = "themes"
|
||||
url = "https://themes.gohugo.io/"
|
||||
|
||||
[[global]]
|
||||
name = "Showcase"
|
||||
weight = 20
|
||||
identifier = "showcase"
|
||||
url = "/showcase/"
|
||||
[[global]]
|
||||
name = "Showcase"
|
||||
weight = 20
|
||||
identifier = "showcase"
|
||||
url = "/showcase/"
|
||||
|
||||
# Anything with a weight > 100 gets an external icon
|
||||
[[global]]
|
||||
name = "Community"
|
||||
weight = 150
|
||||
icon = true
|
||||
identifier = "community"
|
||||
post = "external"
|
||||
url = "https://discourse.gohugo.io/"
|
||||
# Anything with a weight > 100 gets an external icon
|
||||
|
||||
[[global]]
|
||||
name = "Community"
|
||||
weight = 150
|
||||
icon = true
|
||||
identifier = "community"
|
||||
post = "external"
|
||||
url = "https://discourse.gohugo.io/"
|
||||
|
||||
[[global]]
|
||||
name = "GitHub"
|
||||
weight = 200
|
||||
identifier = "github"
|
||||
post = "external"
|
||||
url = "https://github.com/gohugoio/hugo"
|
||||
[[global]]
|
||||
name = "GitHub"
|
||||
weight = 200
|
||||
identifier = "github"
|
||||
post = "external"
|
||||
url = "https://github.com/gohugoio/hugo"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Config for production
|
||||
|
||||
# This is turned off in development as it is relatively slow.
|
||||
# This is turned off in development as it is relatively slow.
|
||||
# This is needed to get accurate lastMod and Git commit info
|
||||
# on the docs pages.
|
||||
enableGitInfo = true
|
||||
@@ -34,7 +34,6 @@ This has many benefits. The most noticeable is performance. HTTP servers are *ve
|
||||
* ["Top 10 Static Website Generators", Netlify blog][]
|
||||
* ["The Resurgence of Static", dotCMS][dotcms]
|
||||
|
||||
|
||||
["An Introduction to Static Site Generators", David Walsh]: https://davidwalsh.name/introduction-static-site-generators
|
||||
["Static Site Generators", O'Reilly]: https://github.com/gohugoio/hugoDocs/files/1242701/static-site-generators.pdf
|
||||
["Top 10 Static Website Generators", Netlify blog]: https://www.netlify.com/blog/2016/05/02/top-ten-static-website-generators/
|
||||
|
||||
@@ -54,7 +54,6 @@ toc: true
|
||||
* Support for [Go][] HTML templates
|
||||
* [Syntax highlighting][] powered by [Chroma][]
|
||||
|
||||
|
||||
[aliases]: /content-management/urls/#aliases
|
||||
[Chroma]: https://github.com/alecthomas/chroma
|
||||
[content summaries]: /content-management/summaries/
|
||||
@@ -64,11 +63,11 @@ toc: true
|
||||
[Extremely fast]: https://github.com/bep/hugo-benchmark
|
||||
[front matter]: /content-management/front-matter/
|
||||
[functions]: /functions/
|
||||
[Go]: https://golang.org/pkg/html/template/
|
||||
[Go]: https://pkg.go.dev/html/template
|
||||
[Google Analytics]: https://google-analytics.com/
|
||||
[homepage]: /templates/homepage/
|
||||
[hostanywhere]: /hosting-and-deployment/
|
||||
[install]: /getting-started/installing/
|
||||
[install]: /installation/
|
||||
[LiveReload]: /getting-started/usage/
|
||||
[organization for your projects]: /getting-started/directory-structure/
|
||||
[pagevars]: /variables/page/
|
||||
|
||||
@@ -16,7 +16,6 @@ aliases: [/privacy/,/gdpr/]
|
||||
toc: true
|
||||
---
|
||||
|
||||
|
||||
General Data Protection Regulation ([GDPR](https://en.wikipedia.org/wiki/General_Data_Protection_Regulation)) is a regulation in EU law on data protection and privacy for all individuals within the European Union and the European Economic Area. It became enforceable on 25 May 2018.
|
||||
|
||||
**Hugo is a static site generator. By using Hugo you are already standing on very solid ground. Static HTML files on disk are much easier to reason about compared to server and database driven web sites.**
|
||||
@@ -95,6 +94,7 @@ useSessionStorage
|
||||
{{% warning %}}
|
||||
`useSessionStorage` is not supported when using Google Analytics v4 (gtag.js).
|
||||
{{% /warning %}}
|
||||
|
||||
### Instagram
|
||||
|
||||
simple
|
||||
@@ -116,8 +116,7 @@ enableDNT
|
||||
simple
|
||||
: If simple mode is enabled, a static and no-JS version of a tweet will be built.
|
||||
|
||||
|
||||
**Note:** If you use the _simple mode_ for Twitter, you may want to disable the inlines styles provided by Hugo:
|
||||
**Note:** If you use the _simple mode_ for Twitter, you may want to disable the inline styles provided by Hugo:
|
||||
|
||||
{{< code-toggle file="config">}}
|
||||
[services]
|
||||
@@ -137,4 +136,3 @@ enableDNT
|
||||
|
||||
simple
|
||||
: If simple mode is enabled, the video thumbnail is fetched from Vimeo's servers and it is overlayed with a play button. If the user clicks to play the video, it will open in a new tab directly on Vimeo's website.
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@ menu:
|
||||
weight: 4
|
||||
weight: 5
|
||||
sections_weight: 5
|
||||
draft: false
|
||||
aliases: [/security/]
|
||||
toc: true
|
||||
---
|
||||
@@ -28,11 +27,8 @@ But when developing and building your site, the runtime is the `hugo` executable
|
||||
* User-defined components have read-only access to the filesystem.
|
||||
* We shell out to some external binaries to support [Asciidoctor](/content-management/formats/#list-of-content-formats) and similar, but those binaries and their flags are predefined and disabled by default (see [Security Policy](#security-policy)). General functions to run arbitrary external OS commands have been [discussed](https://github.com/gohugoio/hugo/issues/796), but not implemented because of security concerns.
|
||||
|
||||
|
||||
## Security Policy
|
||||
|
||||
{{< new-in "0.91.0" >}}
|
||||
|
||||
Hugo has a built-in security policy that restricts access to [os/exec](https://pkg.go.dev/os/exec), remote communication and similar.
|
||||
|
||||
The default configuration is listed below. Any build using features not in the allow list of the security policy will fail with a detailed message about what needs to be done. Most of these settings are allow lists (string or slice, [Regular Expressions](https://pkg.go.dev/regexp) or `none` which matches nothing).
|
||||
@@ -41,7 +37,7 @@ The default configuration is listed below. Any build using features not in the a
|
||||
|
||||
Note that these and other config settings in Hugo can be overridden by the OS environment. If you want to block all remote HTTP fetching of data:
|
||||
|
||||
```
|
||||
```txt
|
||||
HUGO_SECURITY_HTTP_URLS=none hugo
|
||||
```
|
||||
|
||||
@@ -57,7 +53,7 @@ These are the security threats as defined by [OWASP](https://en.wikipedia.org/wi
|
||||
|
||||
For HTML output, this is the core security model:
|
||||
|
||||
https://golang.org/pkg/html/template/#hdr-Security_Model
|
||||
<https://pkg.go.dev/html/template#hdr-Security_Model>
|
||||
|
||||
In short:
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ Hugo is for people building a blog, a company site, a portfolio site, documentat
|
||||
[Firebase]: https://firebase.google.com/docs/hosting/ "Firebase static hosting"
|
||||
[GitHub Pages]: https://pages.github.com/
|
||||
[GitLab Pages]: https://about.gitlab.com/features/pages/
|
||||
[Go language]: https://golang.org/
|
||||
[Go language]: https://go.dev/
|
||||
[GoDaddy]: https://www.godaddy.com/ "GoDaddy.com Hosting"
|
||||
[Google Cloud Storage]: https://cloud.google.com/storage/
|
||||
[Heroku]: https://www.heroku.com/
|
||||
|
||||
@@ -26,7 +26,7 @@ To load completions for every new session, execute once:
|
||||
|
||||
#### macOS:
|
||||
|
||||
hugo completion bash > /usr/local/etc/bash_completion.d/hugo
|
||||
hugo completion bash > $(brew --prefix)/etc/bash_completion.d/hugo
|
||||
|
||||
You will need to start a new shell for this setup to take effect.
|
||||
|
||||
|
||||
@@ -16,6 +16,10 @@ to enable it. You can execute the following once:
|
||||
|
||||
echo "autoload -U compinit; compinit" >> ~/.zshrc
|
||||
|
||||
To load completions in your current shell session:
|
||||
|
||||
source <(hugo completion zsh); compdef _hugo hugo
|
||||
|
||||
To load completions for every new session, execute once:
|
||||
|
||||
#### Linux:
|
||||
@@ -24,7 +28,7 @@ To load completions for every new session, execute once:
|
||||
|
||||
#### macOS:
|
||||
|
||||
hugo completion zsh > /usr/local/share/zsh/site-functions/_hugo
|
||||
hugo completion zsh > $(brew --prefix)/share/zsh/site-functions/_hugo
|
||||
|
||||
You will need to start a new shell for this setup to take effect.
|
||||
|
||||
|
||||
@@ -18,25 +18,25 @@ hugo config [flags]
|
||||
### Options
|
||||
|
||||
```
|
||||
-h, --help help for config
|
||||
--clock string set the clock used by Hugo, e.g. --clock 2021-11-06T22:30:00.00+09:00
|
||||
-e, --environment string build environment
|
||||
-h, --help help for config
|
||||
--ignoreVendorPaths string ignores any _vendor for module paths matching the given Glob pattern
|
||||
-s, --source string filesystem path to read files relative from
|
||||
--themesDir string filesystem path to themes directory
|
||||
```
|
||||
|
||||
### Options inherited from parent commands
|
||||
|
||||
```
|
||||
--clock string set the clock used by Hugo, e.g. --clock 2021-11-06T22:30:00.00+09:00
|
||||
--config string config file (default is path/config.yaml|json|toml)
|
||||
--configDir string config dir (default "config")
|
||||
--debug debug output
|
||||
-e, --environment string build environment
|
||||
--ignoreVendorPaths string ignores any _vendor for module paths matching the given Glob pattern
|
||||
--log enable Logging
|
||||
--logFile string log File path (if set, logging enabled automatically)
|
||||
--quiet build in quiet mode
|
||||
-s, --source string filesystem path to read files relative from
|
||||
--themesDir string filesystem path to themes directory
|
||||
-v, --verbose verbose output
|
||||
--verboseLog verbose logging
|
||||
--config string config file (default is path/config.yaml|json|toml)
|
||||
--configDir string config dir (default "config")
|
||||
--debug debug output
|
||||
--log enable Logging
|
||||
--logFile string log File path (if set, logging enabled automatically)
|
||||
--quiet build in quiet mode
|
||||
-v, --verbose verbose output
|
||||
--verboseLog verbose logging
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
|
||||
@@ -16,27 +16,27 @@ See convert's subcommands toJSON, toTOML and toYAML for more information.
|
||||
### Options
|
||||
|
||||
```
|
||||
-h, --help help for convert
|
||||
-o, --output string filesystem path to write files to
|
||||
--unsafe enable less safe operations, please backup first
|
||||
--clock string set the clock used by Hugo, e.g. --clock 2021-11-06T22:30:00.00+09:00
|
||||
-e, --environment string build environment
|
||||
-h, --help help for convert
|
||||
--ignoreVendorPaths string ignores any _vendor for module paths matching the given Glob pattern
|
||||
-o, --output string filesystem path to write files to
|
||||
-s, --source string filesystem path to read files relative from
|
||||
--themesDir string filesystem path to themes directory
|
||||
--unsafe enable less safe operations, please backup first
|
||||
```
|
||||
|
||||
### Options inherited from parent commands
|
||||
|
||||
```
|
||||
--clock string set the clock used by Hugo, e.g. --clock 2021-11-06T22:30:00.00+09:00
|
||||
--config string config file (default is path/config.yaml|json|toml)
|
||||
--configDir string config dir (default "config")
|
||||
--debug debug output
|
||||
-e, --environment string build environment
|
||||
--ignoreVendorPaths string ignores any _vendor for module paths matching the given Glob pattern
|
||||
--log enable Logging
|
||||
--logFile string log File path (if set, logging enabled automatically)
|
||||
--quiet build in quiet mode
|
||||
-s, --source string filesystem path to read files relative from
|
||||
--themesDir string filesystem path to themes directory
|
||||
-v, --verbose verbose output
|
||||
--verboseLog verbose logging
|
||||
--config string config file (default is path/config.yaml|json|toml)
|
||||
--configDir string config dir (default "config")
|
||||
--debug debug output
|
||||
--log enable Logging
|
||||
--logFile string log File path (if set, logging enabled automatically)
|
||||
--quiet build in quiet mode
|
||||
-v, --verbose verbose output
|
||||
--verboseLog verbose logging
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
|
||||
@@ -22,31 +22,31 @@ hugo deploy [flags]
|
||||
### Options
|
||||
|
||||
```
|
||||
--confirm ask for confirmation before making changes to the target
|
||||
--dryRun dry run
|
||||
--force force upload of all files
|
||||
-h, --help help for deploy
|
||||
--invalidateCDN invalidate the CDN cache listed in the deployment target (default true)
|
||||
--maxDeletes int maximum # of files to delete, or -1 to disable (default 256)
|
||||
--target string target deployment from deployments section in config file; defaults to the first one
|
||||
--clock string set the clock used by Hugo, e.g. --clock 2021-11-06T22:30:00.00+09:00
|
||||
--confirm ask for confirmation before making changes to the target
|
||||
--dryRun dry run
|
||||
-e, --environment string build environment
|
||||
--force force upload of all files
|
||||
-h, --help help for deploy
|
||||
--ignoreVendorPaths string ignores any _vendor for module paths matching the given Glob pattern
|
||||
--invalidateCDN invalidate the CDN cache listed in the deployment target (default true)
|
||||
--maxDeletes int maximum # of files to delete, or -1 to disable (default 256)
|
||||
-s, --source string filesystem path to read files relative from
|
||||
--target string target deployment from deployments section in config file; defaults to the first one
|
||||
--themesDir string filesystem path to themes directory
|
||||
```
|
||||
|
||||
### Options inherited from parent commands
|
||||
|
||||
```
|
||||
--clock string set the clock used by Hugo, e.g. --clock 2021-11-06T22:30:00.00+09:00
|
||||
--config string config file (default is path/config.yaml|json|toml)
|
||||
--configDir string config dir (default "config")
|
||||
--debug debug output
|
||||
-e, --environment string build environment
|
||||
--ignoreVendorPaths string ignores any _vendor for module paths matching the given Glob pattern
|
||||
--log enable Logging
|
||||
--logFile string log File path (if set, logging enabled automatically)
|
||||
--quiet build in quiet mode
|
||||
-s, --source string filesystem path to read files relative from
|
||||
--themesDir string filesystem path to themes directory
|
||||
-v, --verbose verbose output
|
||||
--verboseLog verbose logging
|
||||
--config string config file (default is path/config.yaml|json|toml)
|
||||
--configDir string config dir (default "config")
|
||||
--debug debug output
|
||||
--log enable Logging
|
||||
--logFile string log File path (if set, logging enabled automatically)
|
||||
--quiet build in quiet mode
|
||||
-v, --verbose verbose output
|
||||
--verboseLog verbose logging
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
|
||||
@@ -16,25 +16,25 @@ List requires a subcommand, e.g. `hugo list drafts`.
|
||||
### Options
|
||||
|
||||
```
|
||||
-h, --help help for list
|
||||
--clock string set the clock used by Hugo, e.g. --clock 2021-11-06T22:30:00.00+09:00
|
||||
-e, --environment string build environment
|
||||
-h, --help help for list
|
||||
--ignoreVendorPaths string ignores any _vendor for module paths matching the given Glob pattern
|
||||
-s, --source string filesystem path to read files relative from
|
||||
--themesDir string filesystem path to themes directory
|
||||
```
|
||||
|
||||
### Options inherited from parent commands
|
||||
|
||||
```
|
||||
--clock string set the clock used by Hugo, e.g. --clock 2021-11-06T22:30:00.00+09:00
|
||||
--config string config file (default is path/config.yaml|json|toml)
|
||||
--configDir string config dir (default "config")
|
||||
--debug debug output
|
||||
-e, --environment string build environment
|
||||
--ignoreVendorPaths string ignores any _vendor for module paths matching the given Glob pattern
|
||||
--log enable Logging
|
||||
--logFile string log File path (if set, logging enabled automatically)
|
||||
--quiet build in quiet mode
|
||||
-s, --source string filesystem path to read files relative from
|
||||
--themesDir string filesystem path to themes directory
|
||||
-v, --verbose verbose output
|
||||
--verboseLog verbose logging
|
||||
--config string config file (default is path/config.yaml|json|toml)
|
||||
--configDir string config dir (default "config")
|
||||
--debug debug output
|
||||
--log enable Logging
|
||||
--logFile string log File path (if set, logging enabled automatically)
|
||||
--quiet build in quiet mode
|
||||
-v, --verbose verbose output
|
||||
--verboseLog verbose logging
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
|
||||
@@ -26,53 +26,53 @@ See https://gohugo.io/hugo-modules/ for more information.
|
||||
### Options
|
||||
|
||||
```
|
||||
-b, --baseURL string hostname (and path) to the root, e.g. https://spf13.com/
|
||||
-D, --buildDrafts include content marked as draft
|
||||
-E, --buildExpired include expired content
|
||||
-F, --buildFuture include content with publishdate in the future
|
||||
--cacheDir string filesystem path to cache directory. Defaults: $TMPDIR/hugo_cache/
|
||||
--cleanDestinationDir remove files from destination not found in static directories
|
||||
-c, --contentDir string filesystem path to content directory
|
||||
-d, --destination string filesystem path to write files to
|
||||
--disableKinds strings disable different kind of pages (home, RSS etc.)
|
||||
--enableGitInfo add Git revision, date, author, and CODEOWNERS info to the pages
|
||||
--forceSyncStatic copy all files when static is changed.
|
||||
--gc enable to run some cleanup tasks (remove unused cache files) after the build
|
||||
-h, --help help for mod
|
||||
--ignoreCache ignores the cache directory
|
||||
-l, --layoutDir string filesystem path to layout directory
|
||||
--minify minify any supported output format (HTML, XML etc.)
|
||||
--noBuildLock don't create .hugo_build.lock file
|
||||
--noChmod don't sync permission mode of files
|
||||
--noTimes don't sync modification time of files
|
||||
--panicOnWarning panic on first WARNING log
|
||||
--poll string set this to a poll interval, e.g --poll 700ms, to use a poll based approach to watch for file system changes
|
||||
--printI18nWarnings print missing translations
|
||||
--printMemoryUsage print memory usage to screen at intervals
|
||||
--printPathWarnings print warnings on duplicate target paths etc.
|
||||
--printUnusedTemplates print warnings on unused templates.
|
||||
--templateMetrics display metrics about template executions
|
||||
--templateMetricsHints calculate some improvement hints when combined with --templateMetrics
|
||||
-t, --theme strings themes to use (located in /themes/THEMENAME/)
|
||||
--trace file write trace to file (not useful in general)
|
||||
-b, --baseURL string hostname (and path) to the root, e.g. https://spf13.com/
|
||||
-D, --buildDrafts include content marked as draft
|
||||
-E, --buildExpired include expired content
|
||||
-F, --buildFuture include content with publishdate in the future
|
||||
--cacheDir string filesystem path to cache directory. Defaults: $TMPDIR/hugo_cache/
|
||||
--cleanDestinationDir remove files from destination not found in static directories
|
||||
--clock string set the clock used by Hugo, e.g. --clock 2021-11-06T22:30:00.00+09:00
|
||||
-c, --contentDir string filesystem path to content directory
|
||||
-d, --destination string filesystem path to write files to
|
||||
--disableKinds strings disable different kind of pages (home, RSS etc.)
|
||||
--enableGitInfo add Git revision, date, author, and CODEOWNERS info to the pages
|
||||
-e, --environment string build environment
|
||||
--forceSyncStatic copy all files when static is changed.
|
||||
--gc enable to run some cleanup tasks (remove unused cache files) after the build
|
||||
-h, --help help for mod
|
||||
--ignoreCache ignores the cache directory
|
||||
--ignoreVendorPaths string ignores any _vendor for module paths matching the given Glob pattern
|
||||
-l, --layoutDir string filesystem path to layout directory
|
||||
--minify minify any supported output format (HTML, XML etc.)
|
||||
--noBuildLock don't create .hugo_build.lock file
|
||||
--noChmod don't sync permission mode of files
|
||||
--noTimes don't sync modification time of files
|
||||
--panicOnWarning panic on first WARNING log
|
||||
--poll string set this to a poll interval, e.g --poll 700ms, to use a poll based approach to watch for file system changes
|
||||
--printI18nWarnings print missing translations
|
||||
--printMemoryUsage print memory usage to screen at intervals
|
||||
--printPathWarnings print warnings on duplicate target paths etc.
|
||||
--printUnusedTemplates print warnings on unused templates.
|
||||
-s, --source string filesystem path to read files relative from
|
||||
--templateMetrics display metrics about template executions
|
||||
--templateMetricsHints calculate some improvement hints when combined with --templateMetrics
|
||||
-t, --theme strings themes to use (located in /themes/THEMENAME/)
|
||||
--themesDir string filesystem path to themes directory
|
||||
--trace file write trace to file (not useful in general)
|
||||
```
|
||||
|
||||
### Options inherited from parent commands
|
||||
|
||||
```
|
||||
--clock string set the clock used by Hugo, e.g. --clock 2021-11-06T22:30:00.00+09:00
|
||||
--config string config file (default is path/config.yaml|json|toml)
|
||||
--configDir string config dir (default "config")
|
||||
--debug debug output
|
||||
-e, --environment string build environment
|
||||
--ignoreVendorPaths string ignores any _vendor for module paths matching the given Glob pattern
|
||||
--log enable Logging
|
||||
--logFile string log File path (if set, logging enabled automatically)
|
||||
--quiet build in quiet mode
|
||||
-s, --source string filesystem path to read files relative from
|
||||
--themesDir string filesystem path to themes directory
|
||||
-v, --verbose verbose output
|
||||
--verboseLog verbose logging
|
||||
--config string config file (default is path/config.yaml|json|toml)
|
||||
--configDir string config dir (default "config")
|
||||
--debug debug output
|
||||
--log enable Logging
|
||||
--logFile string log File path (if set, logging enabled automatically)
|
||||
--quiet build in quiet mode
|
||||
-v, --verbose verbose output
|
||||
--verboseLog verbose logging
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
|
||||
@@ -25,55 +25,56 @@ hugo new [path] [flags]
|
||||
### Options
|
||||
|
||||
```
|
||||
-b, --baseURL string hostname (and path) to the root, e.g. https://spf13.com/
|
||||
-D, --buildDrafts include content marked as draft
|
||||
-E, --buildExpired include expired content
|
||||
-F, --buildFuture include content with publishdate in the future
|
||||
--cacheDir string filesystem path to cache directory. Defaults: $TMPDIR/hugo_cache/
|
||||
--cleanDestinationDir remove files from destination not found in static directories
|
||||
-c, --contentDir string filesystem path to content directory
|
||||
-d, --destination string filesystem path to write files to
|
||||
--disableKinds strings disable different kind of pages (home, RSS etc.)
|
||||
--editor string edit new content with this editor, if provided
|
||||
--enableGitInfo add Git revision, date, author, and CODEOWNERS info to the pages
|
||||
--forceSyncStatic copy all files when static is changed.
|
||||
--gc enable to run some cleanup tasks (remove unused cache files) after the build
|
||||
-h, --help help for new
|
||||
--ignoreCache ignores the cache directory
|
||||
-k, --kind string content type to create
|
||||
-l, --layoutDir string filesystem path to layout directory
|
||||
--minify minify any supported output format (HTML, XML etc.)
|
||||
--noBuildLock don't create .hugo_build.lock file
|
||||
--noChmod don't sync permission mode of files
|
||||
--noTimes don't sync modification time of files
|
||||
--panicOnWarning panic on first WARNING log
|
||||
--poll string set this to a poll interval, e.g --poll 700ms, to use a poll based approach to watch for file system changes
|
||||
--printI18nWarnings print missing translations
|
||||
--printMemoryUsage print memory usage to screen at intervals
|
||||
--printPathWarnings print warnings on duplicate target paths etc.
|
||||
--printUnusedTemplates print warnings on unused templates.
|
||||
--templateMetrics display metrics about template executions
|
||||
--templateMetricsHints calculate some improvement hints when combined with --templateMetrics
|
||||
-t, --theme strings themes to use (located in /themes/THEMENAME/)
|
||||
--trace file write trace to file (not useful in general)
|
||||
-b, --baseURL string hostname (and path) to the root, e.g. https://spf13.com/
|
||||
-D, --buildDrafts include content marked as draft
|
||||
-E, --buildExpired include expired content
|
||||
-F, --buildFuture include content with publishdate in the future
|
||||
--cacheDir string filesystem path to cache directory. Defaults: $TMPDIR/hugo_cache/
|
||||
--cleanDestinationDir remove files from destination not found in static directories
|
||||
--clock string set the clock used by Hugo, e.g. --clock 2021-11-06T22:30:00.00+09:00
|
||||
-c, --contentDir string filesystem path to content directory
|
||||
-d, --destination string filesystem path to write files to
|
||||
--disableKinds strings disable different kind of pages (home, RSS etc.)
|
||||
--editor string edit new content with this editor, if provided
|
||||
--enableGitInfo add Git revision, date, author, and CODEOWNERS info to the pages
|
||||
-e, --environment string build environment
|
||||
-f, --force overwrite file if it already exists
|
||||
--forceSyncStatic copy all files when static is changed.
|
||||
--gc enable to run some cleanup tasks (remove unused cache files) after the build
|
||||
-h, --help help for new
|
||||
--ignoreCache ignores the cache directory
|
||||
--ignoreVendorPaths string ignores any _vendor for module paths matching the given Glob pattern
|
||||
-k, --kind string content type to create
|
||||
-l, --layoutDir string filesystem path to layout directory
|
||||
--minify minify any supported output format (HTML, XML etc.)
|
||||
--noBuildLock don't create .hugo_build.lock file
|
||||
--noChmod don't sync permission mode of files
|
||||
--noTimes don't sync modification time of files
|
||||
--panicOnWarning panic on first WARNING log
|
||||
--poll string set this to a poll interval, e.g --poll 700ms, to use a poll based approach to watch for file system changes
|
||||
--printI18nWarnings print missing translations
|
||||
--printMemoryUsage print memory usage to screen at intervals
|
||||
--printPathWarnings print warnings on duplicate target paths etc.
|
||||
--printUnusedTemplates print warnings on unused templates.
|
||||
-s, --source string filesystem path to read files relative from
|
||||
--templateMetrics display metrics about template executions
|
||||
--templateMetricsHints calculate some improvement hints when combined with --templateMetrics
|
||||
-t, --theme strings themes to use (located in /themes/THEMENAME/)
|
||||
--themesDir string filesystem path to themes directory
|
||||
--trace file write trace to file (not useful in general)
|
||||
```
|
||||
|
||||
### Options inherited from parent commands
|
||||
|
||||
```
|
||||
--clock string set the clock used by Hugo, e.g. --clock 2021-11-06T22:30:00.00+09:00
|
||||
--config string config file (default is path/config.yaml|json|toml)
|
||||
--configDir string config dir (default "config")
|
||||
--debug debug output
|
||||
-e, --environment string build environment
|
||||
--ignoreVendorPaths string ignores any _vendor for module paths matching the given Glob pattern
|
||||
--log enable Logging
|
||||
--logFile string log File path (if set, logging enabled automatically)
|
||||
--quiet build in quiet mode
|
||||
-s, --source string filesystem path to read files relative from
|
||||
--themesDir string filesystem path to themes directory
|
||||
-v, --verbose verbose output
|
||||
--verboseLog verbose logging
|
||||
--config string config file (default is path/config.yaml|json|toml)
|
||||
--configDir string config dir (default "config")
|
||||
--debug debug output
|
||||
--log enable Logging
|
||||
--logFile string log File path (if set, logging enabled automatically)
|
||||
--quiet build in quiet mode
|
||||
-v, --verbose verbose output
|
||||
--verboseLog verbose logging
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
|
||||
@@ -20,27 +20,27 @@ hugo new site [path] [flags]
|
||||
### Options
|
||||
|
||||
```
|
||||
--force init inside non-empty directory
|
||||
-f, --format string config file format (default "toml")
|
||||
-h, --help help for site
|
||||
--clock string set the clock used by Hugo, e.g. --clock 2021-11-06T22:30:00.00+09:00
|
||||
-e, --environment string build environment
|
||||
--force init inside non-empty directory
|
||||
-f, --format string config file format (default "toml")
|
||||
-h, --help help for site
|
||||
--ignoreVendorPaths string ignores any _vendor for module paths matching the given Glob pattern
|
||||
-s, --source string filesystem path to read files relative from
|
||||
--themesDir string filesystem path to themes directory
|
||||
```
|
||||
|
||||
### Options inherited from parent commands
|
||||
|
||||
```
|
||||
--clock string set the clock used by Hugo, e.g. --clock 2021-11-06T22:30:00.00+09:00
|
||||
--config string config file (default is path/config.yaml|json|toml)
|
||||
--configDir string config dir (default "config")
|
||||
--debug debug output
|
||||
-e, --environment string build environment
|
||||
--ignoreVendorPaths string ignores any _vendor for module paths matching the given Glob pattern
|
||||
--log enable Logging
|
||||
--logFile string log File path (if set, logging enabled automatically)
|
||||
--quiet build in quiet mode
|
||||
-s, --source string filesystem path to read files relative from
|
||||
--themesDir string filesystem path to themes directory
|
||||
-v, --verbose verbose output
|
||||
--verboseLog verbose logging
|
||||
--config string config file (default is path/config.yaml|json|toml)
|
||||
--configDir string config dir (default "config")
|
||||
--debug debug output
|
||||
--log enable Logging
|
||||
--logFile string log File path (if set, logging enabled automatically)
|
||||
--quiet build in quiet mode
|
||||
-v, --verbose verbose output
|
||||
--verboseLog verbose logging
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
|
||||
@@ -21,25 +21,25 @@ hugo new theme [name] [flags]
|
||||
### Options
|
||||
|
||||
```
|
||||
-h, --help help for theme
|
||||
--clock string set the clock used by Hugo, e.g. --clock 2021-11-06T22:30:00.00+09:00
|
||||
-e, --environment string build environment
|
||||
-h, --help help for theme
|
||||
--ignoreVendorPaths string ignores any _vendor for module paths matching the given Glob pattern
|
||||
-s, --source string filesystem path to read files relative from
|
||||
--themesDir string filesystem path to themes directory
|
||||
```
|
||||
|
||||
### Options inherited from parent commands
|
||||
|
||||
```
|
||||
--clock string set the clock used by Hugo, e.g. --clock 2021-11-06T22:30:00.00+09:00
|
||||
--config string config file (default is path/config.yaml|json|toml)
|
||||
--configDir string config dir (default "config")
|
||||
--debug debug output
|
||||
-e, --environment string build environment
|
||||
--ignoreVendorPaths string ignores any _vendor for module paths matching the given Glob pattern
|
||||
--log enable Logging
|
||||
--logFile string log File path (if set, logging enabled automatically)
|
||||
--quiet build in quiet mode
|
||||
-s, --source string filesystem path to read files relative from
|
||||
--themesDir string filesystem path to themes directory
|
||||
-v, --verbose verbose output
|
||||
--verboseLog verbose logging
|
||||
--config string config file (default is path/config.yaml|json|toml)
|
||||
--configDir string config dir (default "config")
|
||||
--debug debug output
|
||||
--log enable Logging
|
||||
--logFile string log File path (if set, logging enabled automatically)
|
||||
--quiet build in quiet mode
|
||||
-v, --verbose verbose output
|
||||
--verboseLog verbose logging
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
|
||||
@@ -29,67 +29,67 @@ hugo server [flags]
|
||||
### Options
|
||||
|
||||
```
|
||||
--appendPort append port to baseURL (default true)
|
||||
-b, --baseURL string hostname (and path) to the root, e.g. https://spf13.com/
|
||||
--bind string interface to which the server will bind (default "127.0.0.1")
|
||||
-D, --buildDrafts include content marked as draft
|
||||
-E, --buildExpired include expired content
|
||||
-F, --buildFuture include content with publishdate in the future
|
||||
--cacheDir string filesystem path to cache directory. Defaults: $TMPDIR/hugo_cache/
|
||||
--cleanDestinationDir remove files from destination not found in static directories
|
||||
-c, --contentDir string filesystem path to content directory
|
||||
-d, --destination string filesystem path to write files to
|
||||
--disableBrowserError do not show build errors in the browser
|
||||
--disableFastRender enables full re-renders on changes
|
||||
--disableKinds strings disable different kind of pages (home, RSS etc.)
|
||||
--disableLiveReload watch without enabling live browser reload on rebuild
|
||||
--enableGitInfo add Git revision, date, author, and CODEOWNERS info to the pages
|
||||
--forceSyncStatic copy all files when static is changed.
|
||||
--gc enable to run some cleanup tasks (remove unused cache files) after the build
|
||||
-h, --help help for server
|
||||
--ignoreCache ignores the cache directory
|
||||
-l, --layoutDir string filesystem path to layout directory
|
||||
--liveReloadPort int port for live reloading (i.e. 443 in HTTPS proxy situations) (default -1)
|
||||
--meminterval string interval to poll memory usage (requires --memstats), valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h". (default "100ms")
|
||||
--memstats string log memory usage to this file
|
||||
--minify minify any supported output format (HTML, XML etc.)
|
||||
--navigateToChanged navigate to changed content file on live browser reload
|
||||
--noBuildLock don't create .hugo_build.lock file
|
||||
--noChmod don't sync permission mode of files
|
||||
--noHTTPCache prevent HTTP caching
|
||||
--noTimes don't sync modification time of files
|
||||
--panicOnWarning panic on first WARNING log
|
||||
--poll string set this to a poll interval, e.g --poll 700ms, to use a poll based approach to watch for file system changes
|
||||
-p, --port int port on which the server will listen (default 1313)
|
||||
--printI18nWarnings print missing translations
|
||||
--printMemoryUsage print memory usage to screen at intervals
|
||||
--printPathWarnings print warnings on duplicate target paths etc.
|
||||
--printUnusedTemplates print warnings on unused templates.
|
||||
--renderStaticToDisk serve static files from disk and dynamic files from memory
|
||||
--renderToDisk serve all files from disk (default is from memory)
|
||||
--templateMetrics display metrics about template executions
|
||||
--templateMetricsHints calculate some improvement hints when combined with --templateMetrics
|
||||
-t, --theme strings themes to use (located in /themes/THEMENAME/)
|
||||
--trace file write trace to file (not useful in general)
|
||||
-w, --watch watch filesystem for changes and recreate as needed (default true)
|
||||
--appendPort append port to baseURL (default true)
|
||||
-b, --baseURL string hostname (and path) to the root, e.g. https://spf13.com/
|
||||
--bind string interface to which the server will bind (default "127.0.0.1")
|
||||
-D, --buildDrafts include content marked as draft
|
||||
-E, --buildExpired include expired content
|
||||
-F, --buildFuture include content with publishdate in the future
|
||||
--cacheDir string filesystem path to cache directory. Defaults: $TMPDIR/hugo_cache/
|
||||
--cleanDestinationDir remove files from destination not found in static directories
|
||||
--clock string set the clock used by Hugo, e.g. --clock 2021-11-06T22:30:00.00+09:00
|
||||
-c, --contentDir string filesystem path to content directory
|
||||
-d, --destination string filesystem path to write files to
|
||||
--disableBrowserError do not show build errors in the browser
|
||||
--disableFastRender enables full re-renders on changes
|
||||
--disableKinds strings disable different kind of pages (home, RSS etc.)
|
||||
--disableLiveReload watch without enabling live browser reload on rebuild
|
||||
--enableGitInfo add Git revision, date, author, and CODEOWNERS info to the pages
|
||||
-e, --environment string build environment
|
||||
--forceSyncStatic copy all files when static is changed.
|
||||
--gc enable to run some cleanup tasks (remove unused cache files) after the build
|
||||
-h, --help help for server
|
||||
--ignoreCache ignores the cache directory
|
||||
--ignoreVendorPaths string ignores any _vendor for module paths matching the given Glob pattern
|
||||
-l, --layoutDir string filesystem path to layout directory
|
||||
--liveReloadPort int port for live reloading (i.e. 443 in HTTPS proxy situations) (default -1)
|
||||
--meminterval string interval to poll memory usage (requires --memstats), valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h". (default "100ms")
|
||||
--memstats string log memory usage to this file
|
||||
--minify minify any supported output format (HTML, XML etc.)
|
||||
--navigateToChanged navigate to changed content file on live browser reload
|
||||
--noBuildLock don't create .hugo_build.lock file
|
||||
--noChmod don't sync permission mode of files
|
||||
--noHTTPCache prevent HTTP caching
|
||||
--noTimes don't sync modification time of files
|
||||
--panicOnWarning panic on first WARNING log
|
||||
--poll string set this to a poll interval, e.g --poll 700ms, to use a poll based approach to watch for file system changes
|
||||
-p, --port int port on which the server will listen (default 1313)
|
||||
--printI18nWarnings print missing translations
|
||||
--printMemoryUsage print memory usage to screen at intervals
|
||||
--printPathWarnings print warnings on duplicate target paths etc.
|
||||
--printUnusedTemplates print warnings on unused templates.
|
||||
--renderStaticToDisk serve static files from disk and dynamic files from memory
|
||||
--renderToDisk serve all files from disk (default is from memory)
|
||||
-s, --source string filesystem path to read files relative from
|
||||
--templateMetrics display metrics about template executions
|
||||
--templateMetricsHints calculate some improvement hints when combined with --templateMetrics
|
||||
-t, --theme strings themes to use (located in /themes/THEMENAME/)
|
||||
--themesDir string filesystem path to themes directory
|
||||
--trace file write trace to file (not useful in general)
|
||||
-w, --watch watch filesystem for changes and recreate as needed (default true)
|
||||
```
|
||||
|
||||
### Options inherited from parent commands
|
||||
|
||||
```
|
||||
--clock string set the clock used by Hugo, e.g. --clock 2021-11-06T22:30:00.00+09:00
|
||||
--config string config file (default is path/config.yaml|json|toml)
|
||||
--configDir string config dir (default "config")
|
||||
--debug debug output
|
||||
-e, --environment string build environment
|
||||
--ignoreVendorPaths string ignores any _vendor for module paths matching the given Glob pattern
|
||||
--log enable Logging
|
||||
--logFile string log File path (if set, logging enabled automatically)
|
||||
--quiet build in quiet mode
|
||||
-s, --source string filesystem path to read files relative from
|
||||
--themesDir string filesystem path to themes directory
|
||||
-v, --verbose verbose output
|
||||
--verboseLog verbose logging
|
||||
--config string config file (default is path/config.yaml|json|toml)
|
||||
--configDir string config dir (default "config")
|
||||
--debug debug output
|
||||
--log enable Logging
|
||||
--logFile string log File path (if set, logging enabled automatically)
|
||||
--quiet build in quiet mode
|
||||
-v, --verbose verbose output
|
||||
--verboseLog verbose logging
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
|
||||
@@ -1,20 +1,16 @@
|
||||
---
|
||||
title: Content Management
|
||||
linktitle: Content Management Overview
|
||||
linkTitle: Content Management Overview
|
||||
description: Hugo makes managing large static sites easy with support for archetypes, content types, menus, cross references, summaries, and more.
|
||||
date: 2017-02-01
|
||||
publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
menu:
|
||||
docs:
|
||||
parent: "content-management"
|
||||
weight: 1
|
||||
parent: content-management
|
||||
weight: 10
|
||||
keywords: [source, organization]
|
||||
categories: [content management]
|
||||
weight: 01 #rem
|
||||
draft: false
|
||||
aliases: [/content/,/content/organization]
|
||||
toc: false
|
||||
weight: 10
|
||||
aliases: [/content/,/content/organization]
|
||||
---
|
||||
|
||||
A static site generator needs to extend beyond front matter and a couple of templates to be both scalable and *manageable*. Hugo was designed with not only developers in mind, but also content managers and authors.
|
||||
|
||||
@@ -1,20 +1,17 @@
|
||||
---
|
||||
title: Archetypes
|
||||
linktitle: Archetypes
|
||||
linkTitle: Archetypes
|
||||
description: Archetypes are templates used when creating new content.
|
||||
date: 2017-02-01
|
||||
publishdate: 2017-02-01
|
||||
keywords: [archetypes,generators,metadata,front matter]
|
||||
categories: ["content management"]
|
||||
categories: [content management]
|
||||
menu:
|
||||
docs:
|
||||
parent: "content-management"
|
||||
weight: 70
|
||||
parent: content-management
|
||||
weight: 140
|
||||
quicklinks:
|
||||
weight: 70 #rem
|
||||
draft: false
|
||||
aliases: [/content/archetypes/]
|
||||
toc: true
|
||||
weight: 140
|
||||
aliases: [/content/archetypes/]
|
||||
---
|
||||
|
||||
## What are Archetypes?
|
||||
@@ -69,7 +66,6 @@ It will create a new newsletter type of content file based on the archetype temp
|
||||
|
||||
The above _newsletter type archetype_ illustrates the possibilities: The full Hugo `.Site` and all of Hugo's template funcs can be used in the archetype file.
|
||||
|
||||
|
||||
## Directory based archetypes
|
||||
|
||||
Since Hugo `0.49` you can use complete directories as archetype templates. Given this archetype directory:
|
||||
@@ -90,8 +86,6 @@ hugo new --kind post-bundle posts/my-post
|
||||
|
||||
Will create a new folder in `/content/posts/my-post` with the same set of files as in the `post-bundle` archetypes folder. All content files (`index.md` etc.) can contain template logic, and will receive the correct `.Site` for the content's language.
|
||||
|
||||
|
||||
|
||||
[archetypes directory]: /getting-started/directory-structure/
|
||||
[content types]: /content-management/types/
|
||||
[front matter]: /content-management/front-matter/
|
||||
|
||||
@@ -1,19 +1,16 @@
|
||||
---
|
||||
title: Build Options
|
||||
linktitle: Build Options
|
||||
linkTitle: Build Options
|
||||
description: Build options help define how Hugo must treat a given page when building the site.
|
||||
date: 2020-03-02
|
||||
publishdate: 2020-03-02
|
||||
keywords: [build,content,front matter, page resources]
|
||||
categories: ["content management"]
|
||||
categories: [content management]
|
||||
menu:
|
||||
docs:
|
||||
parent: "content-management"
|
||||
weight: 31
|
||||
weight: 31 #rem
|
||||
draft: false
|
||||
aliases: [/content/build-options/]
|
||||
parent: content-management
|
||||
weight: 70
|
||||
toc: true
|
||||
weight: 70
|
||||
aliases: [/content/build-options/]
|
||||
---
|
||||
|
||||
They are stored in a reserved Front Matter object named `_build` with the following defaults:
|
||||
@@ -26,9 +23,10 @@ _build:
|
||||
{{< /code-toggle >}}
|
||||
|
||||
#### render
|
||||
|
||||
If `always`, the page will be treated as a published page, holding its dedicated output files (`index.html`, etc...) and permalink.
|
||||
|
||||
{{< new-in "0.76.0" >}} We extended this property from a boolean to an enum in Hugo 0.76.0. Valid values are:
|
||||
We extended this property from a boolean to an enum in Hugo 0.76.0. Valid values are:
|
||||
|
||||
never
|
||||
: The page will not be included in any page collection.
|
||||
@@ -52,13 +50,13 @@ always (default)
|
||||
: The page will be included in all page collections, e.g. `site.RegularPages`, `$page.Pages`.
|
||||
|
||||
local
|
||||
: The page will be included in any _local_ page collection, e.g. `$page.RegularPages`, `$page.Pages`. One use case for this would be to create fully navigable, but headless content sections. {{< new-in "0.68.0" >}}
|
||||
: The page will be included in any _local_ page collection, e.g. `$page.RegularPages`, `$page.Pages`. One use case for this would be to create fully navigable, but headless content sections.
|
||||
|
||||
If true, the page will be treated as part of the project's collections and, when appropriate, returned by Hugo's listing methods (`.Pages`, `.RegularPages` etc...).
|
||||
|
||||
#### publishResources
|
||||
|
||||
If set to true the [Bundle's Resources]({{< relref "content-management/page-bundles" >}}) will be published.
|
||||
If set to true the [Bundle's Resources]({{< relref "content-management/page-bundles" >}}) will be published.
|
||||
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 %}}
|
||||
@@ -70,6 +68,7 @@ Any page, regardless of their build options, will always be available using the
|
||||
### Illustrative use cases
|
||||
|
||||
#### Not publishing a page
|
||||
|
||||
Project needs a "Who We Are" content file for Front Matter and body to be used by the homepage but nowhere else.
|
||||
|
||||
```yaml
|
||||
|
||||
@@ -1,20 +1,16 @@
|
||||
---
|
||||
title: Comments
|
||||
linktitle: Comments
|
||||
linkTitle: Comments
|
||||
description: Hugo ships with an internal Disqus template, but this isn't the only commenting system that will work with your new Hugo website.
|
||||
date: 2017-02-01
|
||||
publishdate: 2017-02-01
|
||||
lastmod: 2017-03-09
|
||||
keywords: [sections,content,organization]
|
||||
categories: [project organization, fundamentals]
|
||||
menu:
|
||||
docs:
|
||||
parent: "content-management"
|
||||
weight: 140
|
||||
weight: 140 #rem
|
||||
draft: false
|
||||
aliases: [/extras/comments/]
|
||||
parent: content-management
|
||||
weight: 220
|
||||
toc: true
|
||||
weight: 220
|
||||
aliases: [/extras/comments/]
|
||||
---
|
||||
|
||||
Hugo ships with support for [Disqus](https://disqus.com/), a third-party service that provides comment and community capabilities to websites via JavaScript.
|
||||
@@ -43,7 +39,7 @@ For many websites, this is enough configuration. However, you also have the opti
|
||||
|
||||
Disqus has its own [internal template](https://gohugo.io/templates/internal/#disqus) available, to render it add the following code where you want comments to appear:
|
||||
|
||||
```
|
||||
```go-html-template
|
||||
{{ template "_internal/disqus.html" . }}
|
||||
```
|
||||
|
||||
@@ -56,11 +52,12 @@ These are some alternatives to Disqus:
|
||||
* [Graph Comment](https://graphcomment.com/)
|
||||
* [Hyvor Talk](https://talk.hyvor.com/) (Available as a service)
|
||||
* [IntenseDebate](https://intensedebate.com/)
|
||||
* [Isso](https://posativ.org/isso/) (Self-hosted, Python) ([tutorial][issotutorial])
|
||||
* [Isso](https://isso-comments.de/) (Self-hosted, Python) ([tutorial][issotutorial])
|
||||
* [Muut](https://muut.com/)
|
||||
* [Remark42](https://remark42.com/) (Open source, Golang, Easy to run docker)
|
||||
* [ReplyBox](https://getreplybox.com/)
|
||||
* [Staticman](https://staticman.net/)
|
||||
* [Talkyard](https://www.talkyard.io/blog-comments) (Open source, & serverless hosting)
|
||||
* [Talkyard](https://blog-comments.talkyard.io/) (Open source, & serverless hosting)
|
||||
* [Utterances](https://utteranc.es/) (Open source, GitHub comments widget built on GitHub issues)
|
||||
|
||||
[configuration]: /getting-started/configuration/
|
||||
|
||||
@@ -1,31 +1,49 @@
|
||||
---
|
||||
title: Links and Cross References
|
||||
linkTitle: Links and Cross References
|
||||
description: Shortcodes for creating links to documents.
|
||||
date: 2017-02-01
|
||||
publishdate: 2017-02-01
|
||||
lastmod: 2017-03-31
|
||||
categories: [content management]
|
||||
keywords: ["cross references","references", "anchors", "urls"]
|
||||
menu:
|
||||
docs:
|
||||
parent: "content-management"
|
||||
weight: 100
|
||||
weight: 100 #rem
|
||||
aliases: [/extras/crossreferences/]
|
||||
parent: content-management
|
||||
weight: 170
|
||||
toc: true
|
||||
weight: 170
|
||||
aliases: [/extras/crossreferences/]
|
||||
---
|
||||
|
||||
The `ref` and `relref` shortcodes display the absolute and relative permalinks to a document, respectively.
|
||||
|
||||
## Use `ref` and `relref`
|
||||
## Use of `ref` and `relref`
|
||||
|
||||
```go-html-template
|
||||
{{</* ref "document" */>}}
|
||||
{{</* ref "document#anchor" */>}}
|
||||
{{</* ref "document.md" */>}}
|
||||
{{</* ref "document.md#anchor" */>}}
|
||||
{{</* ref "#anchor" */>}}
|
||||
{{</* ref "/blog/my-post" */>}}
|
||||
The `ref` and `relref` shortcodes require a single parameter: the path to a content document, with or without a file extension, with or without an anchor. Paths without a leading `/` are first resolved relative to the current page, then to the remainder of the site.
|
||||
|
||||
```
|
||||
.
|
||||
└── content
|
||||
├── about
|
||||
| ├── _index.md
|
||||
| └── credits.md
|
||||
├── pages
|
||||
| ├── document1.md
|
||||
| └── document2.md // has anchor #anchor
|
||||
├── products
|
||||
| └── index.md
|
||||
└── blog
|
||||
└── my-post.md
|
||||
```
|
||||
|
||||
The pages can be referenced as follows:
|
||||
|
||||
|
||||
```text
|
||||
{{</* ref "document2" */>}} // <- From pages/document1.md, relative path
|
||||
{{</* ref "document2#anchor" */>}}
|
||||
{{</* ref "document2.md" */>}}
|
||||
{{</* ref "document2.md#anchor" */>}}
|
||||
{{</* ref "#anchor" */>}} // <- From pages/document2.md
|
||||
{{</* ref "/blog/my-post" */>}} // <- From anywhere, absolute path
|
||||
{{</* ref "/blog/my-post.md" */>}}
|
||||
{{</* relref "document" */>}}
|
||||
{{</* relref "document.md" */>}}
|
||||
@@ -33,15 +51,22 @@ The `ref` and `relref` shortcodes display the absolute and relative permalinks t
|
||||
{{</* relref "/blog/my-post.md" */>}}
|
||||
```
|
||||
|
||||
To generate a hyperlink using `ref` or `relref` in markdown:
|
||||
index.md can be reference either by its path or by its containing folder without the ending `/`. \_index.md can be referenced only by its containing folder:
|
||||
|
||||
```md
|
||||
[About]({{</* ref "/page/about" */>}} "About Us")
|
||||
```text
|
||||
{{</* ref "/about" */>}} // <- References /about/_index.md
|
||||
{{</* ref "/about/_index" */>}} // Raises REF_NOT_FOUND error
|
||||
{{</* ref "/about/credits.md" */>}} // <- References /about/credits.md
|
||||
|
||||
{{</* ref "/products" */>}} // <- References /products/index.md
|
||||
{{</* ref "/products/index" */>}} // <- References /products/index.md
|
||||
```
|
||||
|
||||
The `ref` and `relref` shortcodes require a single parameter: the path to a content document, with or without a file extension, with or without an anchor.
|
||||
To generate a hyperlink using `ref` or `relref` in markdown:
|
||||
|
||||
**Paths without a leading `/` are first resolved relative to the current page, then to the remainder of the site.
|
||||
```text
|
||||
[About]({{</* ref "/about" */>}} "About Us")
|
||||
```
|
||||
|
||||
Hugo emits an error or warning if a document cannot be uniquely resolved. The error behavior is configurable; see below.
|
||||
|
||||
@@ -116,7 +141,7 @@ produces this HTML:
|
||||
|
||||
The behavior can, since Hugo 0.45, be configured in `config.toml`:
|
||||
|
||||
refLinksErrorLevel ("ERROR")
|
||||
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
|
||||
|
||||
@@ -1,25 +1,23 @@
|
||||
---
|
||||
title: Diagrams
|
||||
date: 2022-02-20
|
||||
LinkTitle: Diagrams
|
||||
description: Use fenced code blocks and markdown render hooks to display diagrams.
|
||||
categories: [content management]
|
||||
keywords: [diagrams,drawing]
|
||||
menu:
|
||||
docs:
|
||||
parent: "content-management"
|
||||
weight: 22
|
||||
weight: 22
|
||||
parent: content-management
|
||||
weight: 50
|
||||
toc: true
|
||||
weight: 50
|
||||
---
|
||||
|
||||
|
||||
{{< new-in "0.93.0" >}}
|
||||
|
||||
|
||||
## GoAT Diagrams (Ascii)
|
||||
|
||||
Hugo! supports [GoAT](https://github.com/bep/goat) natively. This means that this code block:
|
||||
Hugo supports [GoAT](https://github.com/bep/goat) natively. This means that this code block:
|
||||
|
||||
````
|
||||
````txt
|
||||
```goat
|
||||
. . . .--- 1 .-- 1 / 1
|
||||
/ \ | | .---+ .-+ +
|
||||
@@ -45,14 +43,9 @@ Will be rendered as:
|
||||
1 2 3 4 1 2 3 4 1 2 3 4 '--- 4 '-- 4 \ 4
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Mermaid Diagrams
|
||||
|
||||
Hugo currently does not provide default templates for Mermaid diagrams. But you can easily add your own. One way to do it would be to create ` layouts/_default/_markup/render-codeblock-mermaid.html`:
|
||||
|
||||
Hugo currently does not provide default templates for Mermaid diagrams. But you can easily add your own. One way to do it would be to create `layouts/_default/_markup/render-codeblock-mermaid.html`:
|
||||
|
||||
```go-html-template
|
||||
<div class="mermaid">
|
||||
@@ -61,7 +54,7 @@ Hugo currently does not provide default templates for Mermaid diagrams. But you
|
||||
{{ .Page.Store.Set "hasMermaid" true }}
|
||||
```
|
||||
|
||||
And then include this snippet at the bottom of the content template (below `.Content`):
|
||||
And then include this snippet at the bottom of the content template (**Note**: below `.Content` as the render hook is not processed until `.Content` is executed):
|
||||
|
||||
```go-html-template
|
||||
{{ if .Page.Store.Get "hasMermaid" }}
|
||||
@@ -88,8 +81,6 @@ sequenceDiagram
|
||||
Bob-->>John: Jolly good!
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Goat Ascii Diagram Examples
|
||||
|
||||
### Graphics
|
||||
@@ -160,7 +151,7 @@ sequenceDiagram
|
||||
|
||||
### File tree
|
||||
|
||||
Created from https://arthursonzogni.com/Diagon/#Tree
|
||||
Created from <https://arthursonzogni.com/Diagon/#Tree>
|
||||
|
||||
```goat { width=300 color="orange" }
|
||||
───Linux─┬─Android
|
||||
@@ -176,7 +167,7 @@ Created from https://arthursonzogni.com/Diagon/#Tree
|
||||
|
||||
### Sequence Diagram
|
||||
|
||||
https://arthursonzogni.com/Diagon/#Sequence
|
||||
<https://arthursonzogni.com/Diagon/#Sequence>
|
||||
|
||||
```goat { class="w-40" }
|
||||
┌─────┐ ┌───┐
|
||||
@@ -197,7 +188,7 @@ https://arthursonzogni.com/Diagon/#Sequence
|
||||
|
||||
### Flowchart
|
||||
|
||||
https://arthursonzogni.com/Diagon/#Flowchart
|
||||
<https://arthursonzogni.com/Diagon/#Flowchart>
|
||||
|
||||
```goat
|
||||
_________________
|
||||
@@ -243,7 +234,7 @@ https://arthursonzogni.com/Diagon/#Flowchart
|
||||
|
||||
### Table
|
||||
|
||||
https://arthursonzogni.com/Diagon/#Table
|
||||
<https://arthursonzogni.com/Diagon/#Table>
|
||||
|
||||
```goat { class="w-80 dark-blue" }
|
||||
┌────────────────────────────────────────────────┐
|
||||
@@ -272,6 +263,3 @@ https://arthursonzogni.com/Diagon/#Table
|
||||
│LITERAL = """" character { character } """" .│
|
||||
└────────────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,19 +1,16 @@
|
||||
---
|
||||
title: Content Formats
|
||||
linktitle: Content Formats
|
||||
linkTitle: Content Formats
|
||||
description: Both HTML and Markdown are supported content formats.
|
||||
date: 2017-01-10
|
||||
publishdate: 2017-01-10
|
||||
categories: [content management]
|
||||
keywords: [markdown,asciidoc,pandoc,content format]
|
||||
menu:
|
||||
docs:
|
||||
parent: "content-management"
|
||||
weight: 20
|
||||
weight: 20 #rem
|
||||
draft: false
|
||||
aliases: [/content/markdown-extras/,/content/supported-formats/,/doc/supported-formats/]
|
||||
parent: content-management
|
||||
weight: 40
|
||||
toc: true
|
||||
weight: 40
|
||||
aliases: [/content/markdown-extras/,/content/supported-formats/,/doc/supported-formats/]
|
||||
---
|
||||
|
||||
You can put any file type into your `/content` directories, but Hugo uses the `markup` front matter value if set or the file extension (see `Markup identifiers` in the table below) to determine if the markup needs to be processed, e.g.:
|
||||
@@ -28,7 +25,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/).{{< new-in "0.60.0" >}} |
|
||||
| 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/).|
|
||||
|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.|
|
||||
@@ -55,13 +52,13 @@ Because additional formats are external commands, generation performance will re
|
||||
|
||||
### External Helper AsciiDoc
|
||||
|
||||
[AsciiDoc](https://github.com/asciidoc/asciidoc) implementation EOLs in Jan 2020 and is no longer supported.
|
||||
AsciiDoc development is being continued under [Asciidoctor](https://github.com/asciidoctor). The format AsciiDoc
|
||||
[AsciiDoc](https://github.com/asciidoc/asciidoc) implementation EOLs in Jan 2020 and is no longer supported.
|
||||
AsciiDoc development is being continued under [Asciidoctor](https://github.com/asciidoctor). The format AsciiDoc
|
||||
remains of course. Please continue with the implementation Asciidoctor.
|
||||
|
||||
### External Helper Asciidoctor
|
||||
|
||||
The Asciidoctor community offers a wide set of tools for the AsciiDoc format that can be installed additionally to Hugo.
|
||||
The Asciidoctor community offers a wide set of tools for the AsciiDoc format that can be installed additionally to Hugo.
|
||||
[See the Asciidoctor docs for installation instructions](https://asciidoctor.org/docs/install-toolchain/). Make sure that also all
|
||||
optional extensions like `asciidoctor-diagram` or `asciidoctor-html5s` are installed if required.
|
||||
|
||||
@@ -100,7 +97,7 @@ Notice that for security concerns only extensions that do not have path separato
|
||||
|
||||
Example of how to set extensions and attributes:
|
||||
|
||||
```
|
||||
```yml
|
||||
[markup.asciidocExt]
|
||||
extensions = ["asciidoctor-html5s", "asciidoctor-diagram"]
|
||||
workingFolderCurrent = true
|
||||
@@ -109,10 +106,10 @@ Example of how to set extensions and attributes:
|
||||
my-attribute-name = "my value"
|
||||
```
|
||||
|
||||
In a complex Asciidoctor environment it is sometimes helpful to debug the exact call to your external helper with all
|
||||
In a complex Asciidoctor environment it is sometimes helpful to debug the exact call to your external helper with all
|
||||
parameters. Run Hugo with `-v`. You will get an output like
|
||||
|
||||
```
|
||||
```txt
|
||||
INFO 2019/12/22 09:08:48 Rendering book-as-pdf.adoc with C:\Ruby26-x64\bin\asciidoctor.bat using asciidoc args [--no-header-footer -r asciidoctor-html5s -b html5s -r asciidoctor-diagram --base-dir D:\prototypes\hugo_asciidoc_ddd\docs -a outdir=D:\prototypes\hugo_asciidoc_ddd\build -] ...
|
||||
```
|
||||
|
||||
|
||||
@@ -1,20 +1,17 @@
|
||||
---
|
||||
title: Front Matter
|
||||
linktitle:
|
||||
linkTitle: Front Matter
|
||||
description: Hugo allows you to add front matter in yaml, toml, or json to your content files.
|
||||
date: 2017-01-09
|
||||
publishdate: 2017-01-09
|
||||
lastmod: 2017-02-24
|
||||
categories: [content management]
|
||||
keywords: ["front matter", "yaml", "toml", "json", "metadata", "archetypes"]
|
||||
menu:
|
||||
docs:
|
||||
parent: "content-management"
|
||||
weight: 30
|
||||
weight: 30 #rem
|
||||
draft: false
|
||||
aliases: [/content/front-matter/]
|
||||
parent: content-management
|
||||
weight: 60
|
||||
toc: true
|
||||
weight: 60
|
||||
aliases: [/content/front-matter/]
|
||||
---
|
||||
|
||||
**Front matter** allows you to keep metadata attached to an instance of a [content type][]---i.e., embedded inside a content file---and is one of the many features that gives Hugo its strength.
|
||||
@@ -68,7 +65,7 @@ cascade
|
||||
: a map of Front Matter keys whose values are passed down to the page's descendants unless overwritten by self or a closer ancestor's cascade. See [Front Matter Cascade](#front-matter-cascade) for details.
|
||||
|
||||
date
|
||||
: the datetime assigned to this page. This is usually fetched from the `date` field in front matter, but this behaviour is configurable.
|
||||
: the datetime assigned to this page. This is usually fetched from the `date` field in front matter, but this behavior is configurable.
|
||||
|
||||
description
|
||||
: the description for the content.
|
||||
@@ -137,7 +134,7 @@ weight
|
||||
: used for [ordering your content in lists][ordering]. Lower weight gets higher precedence. So content with lower weight will come first. If set, weights should be non-zero, as 0 is interpreted as an *unset* weight.
|
||||
|
||||
\<taxonomies\>
|
||||
: 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._
|
||||
: 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 "Hugo's Default URL Destinations" %}}
|
||||
If neither `slug` nor `url` is present and [permalinks are not configured otherwise in your site `config` 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.
|
||||
@@ -160,9 +157,7 @@ Any node or section can pass down to descendants a set of Front Matter values as
|
||||
|
||||
### Target Specific Pages
|
||||
|
||||
{{< new-in "0.76.0" >}}
|
||||
|
||||
Since Hugo 0.76 the `cascade` block can be a slice with a optional `_target` keyword, allowing for multiple `cascade` values targeting different page sets.
|
||||
The `cascade` block can be a slice with a optional `_target` keyword, allowing for multiple `cascade` values targeting different page sets.
|
||||
|
||||
{{< code-toggle copy="false" >}}
|
||||
title ="Blog"
|
||||
@@ -181,7 +176,7 @@ kind="section"
|
||||
Keywords available for `_target`:
|
||||
|
||||
path
|
||||
: A [Glob](https://github.com/gobwas/glob) pattern matching the content path below /content. Expects Unix-styled slashes. Note that this is the virtual path, so it starts at the mount root. The matching support double-asterisks so you can match for patterns like `/blog/*/**` to match anything from the third level and down.
|
||||
: A [Glob](https://github.com/gobwas/glob) pattern matching the content path below /content. Expects Unix-styled slashes. Note that this is the virtual path, so it starts at the mount root. The matching supports double-asterisks so you can match for patterns like `/blog/*/**` to match anything from the third level and down.
|
||||
|
||||
kind
|
||||
: A Glob pattern matching the Page's Kind(s), e.g. "{home,section}".
|
||||
@@ -192,7 +187,7 @@ lang
|
||||
environment
|
||||
: A Glob pattern matching the build environment, e.g. "{production,development}"
|
||||
|
||||
Any of the above can be omitted.
|
||||
Any of the above can be omitted.
|
||||
|
||||
### Example
|
||||
|
||||
@@ -206,11 +201,9 @@ cascade:
|
||||
|
||||
With the above example the Blog section page and its descendants will return `images/typewriter.jpg` when `.Params.banner` is invoked unless:
|
||||
|
||||
- Said descendant has its own `banner` value set
|
||||
- Said descendant has its own `banner` value set
|
||||
- Or a closer ancestor node has its own `cascade.banner` value set.
|
||||
|
||||
|
||||
|
||||
## Order Content Through Front Matter
|
||||
|
||||
You can assign content-specific `weight` in the front matter of your content. These values are especially useful for [ordering][ordering] in list views. You can use `weight` for ordering of content and the convention of [`<TAXONOMY>_weight`][taxweight] for ordering content within a taxonomy. See [Ordering and Grouping Hugo Lists][lists] to see how `weight` can be used to organize your content in list views.
|
||||
@@ -221,9 +214,9 @@ It's possible to set some options for Markdown rendering in a content's front ma
|
||||
|
||||
## Front Matter Format Specs
|
||||
|
||||
* [TOML Spec][toml]
|
||||
* [YAML Spec][yaml]
|
||||
* [JSON Spec][json]
|
||||
- [TOML Spec][toml]
|
||||
- [YAML Spec][yaml]
|
||||
- [JSON Spec][json]
|
||||
|
||||
[variables]: /variables/
|
||||
[aliases]: /content-management/urls/#aliases
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
---
|
||||
title: "Image Processing"
|
||||
description: "Resize, crop, rotate, filter, and convert images."
|
||||
date: 2018-01-24T13:10:00-05:00
|
||||
categories: ["content management"]
|
||||
title: Image Processing
|
||||
linkTitle: Image Processing
|
||||
description: Resize, crop, rotate, filter, and convert images.
|
||||
categories: [content management]
|
||||
keywords: [resources, images]
|
||||
weight: 4004
|
||||
draft: false
|
||||
toc: true
|
||||
menu:
|
||||
docs:
|
||||
parent: "content-management"
|
||||
weight: 32
|
||||
parent: content-management
|
||||
weight: 90
|
||||
toc: true
|
||||
weight: 90
|
||||
---
|
||||
## Image Resources
|
||||
|
||||
@@ -28,12 +27,6 @@ content/
|
||||
└── sunset.jpg <-- page resource
|
||||
```
|
||||
|
||||
To access an image as a page resource:
|
||||
|
||||
```go-html-template
|
||||
{{ $image := .Resources.GetMatch "sunset.jpg" }}
|
||||
```
|
||||
|
||||
### Global Resources
|
||||
|
||||
A global resource is a file:
|
||||
@@ -90,10 +83,10 @@ Example 3: A more concise way to skip image rendering if the resource is not fou
|
||||
|
||||
## Image Processing Methods
|
||||
|
||||
The `image` resource implements the `Resize`, `Fit`, `Fill`, `Crop`, `Filter`, and `Exif` methods.
|
||||
The `image` resource implements the [`Resize`], [`Fit`], [`Fill`], [`Crop`], [`Filter`], [`Colors`] and [`Exif`] methods.
|
||||
|
||||
{{% note %}}
|
||||
Metadata (Exif, IPTC, XMP, etc.) is not preserved during image transformation. Use the`Exif` method with the _original_ image to extract Exif metadata from JPEG or TIFF images.
|
||||
Metadata (Exif, IPTC, XMP, etc.) is not preserved during image transformation. Use the [`Exif`] method with the _original_ image to extract Exif metadata from JPEG or TIFF images.
|
||||
{{% /note %}}
|
||||
|
||||
### Resize
|
||||
@@ -159,11 +152,24 @@ Sometimes it can be useful to create the filter chain once and then reuse it.
|
||||
{{ $image2 := $image2.Filter $filters }}
|
||||
```
|
||||
|
||||
### Colors
|
||||
|
||||
{{< new-in "0.104.0" >}}
|
||||
|
||||
`.Colors` returns a slice of hex strings with the dominant colors in the image using a simple histogram method.
|
||||
|
||||
```go-html-template
|
||||
{{ $colors := $image.Colors }}
|
||||
```
|
||||
|
||||
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.
|
||||
|
||||
You may access Exif data in JPEG and TIFF images. To prevent errors when processing images without Exif data, wrap the access in a `with` statement.
|
||||
You may access Exif data in JPEG and TIFF images. To prevent errors when processing images without Exif data, wrap the access in a [`with`] statement.
|
||||
|
||||
```go-html-template
|
||||
{{ with $image.Exif }}
|
||||
@@ -209,11 +215,11 @@ 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-separated, case-insensitive list of options. The order of the options within the list is irrelevant.
|
||||
|
||||
### Dimensions
|
||||
|
||||
With the `Resize` method you must specify width, height, or both. The `Fit`, `Fill`, and `Crop` methods require both width and height. All dimensions are in pixels.
|
||||
With the [`Resize`] method you must specify width, height, or both. The [`Fit`], [`Fill`], and [`Crop`] methods require both width and height. All dimensions are in pixels.
|
||||
|
||||
```go-html-template
|
||||
{{ $image := $image.Resize "600x" }}
|
||||
@@ -248,9 +254,9 @@ In the example above, on the second line, we have reversed width and height to r
|
||||
|
||||
### Anchor
|
||||
|
||||
When using the `Crop` or `Fill` method, the _anchor_ determines the placement of the crop box. You may specify `TopLeft`, `Top`, `TopRight`, `Left`, `Center`,`Right`, `BottomLeft`, `Bottom`, `BottomRight`, or `Smart`.
|
||||
When using the [`Crop`] or [`Fill`] method, the _anchor_ determines the placement of the crop box. You may specify `TopLeft`, `Top`, `TopRight`, `Left`, `Center`,`Right`, `BottomLeft`, `Bottom`, `BottomRight`, or `Smart`.
|
||||
|
||||
The default value is `Smart`, which uses [Smartcrop] image analysis to determine the optimal placement of the crop box. You may override the default value in the [site configuration](#processing-options).
|
||||
The default value is `Smart`, which uses [Smartcrop] image analysis to determine the optimal placement of the crop box. You may override the default value in the [site configuration].
|
||||
|
||||
For example, if you have a 400x200 image with a bird in the upper left quadrant, you can create a 200x100 thumbnail containing the bird:
|
||||
|
||||
@@ -258,7 +264,7 @@ For example, if you have a 400x200 image with a bird in the upper left quadrant,
|
||||
{{ $image.Crop "200x100 TopLeft" }}
|
||||
```
|
||||
|
||||
If you apply rotation when using the `Crop` or `Fill` method, specify the anchor relative to the rotated image.
|
||||
If you apply [rotation](#rotation) when using the [`Crop`] or [`Fill`] method, specify the anchor relative to the rotated image.
|
||||
|
||||
### Target Format
|
||||
|
||||
@@ -282,7 +288,7 @@ To convert an image without scaling, use the dimensions of the original image:
|
||||
|
||||
Applicable to JPEG and WebP images, the `q` value determines the quality of the converted image. Higher values produce better quality images, while lower values produce smaller files. Set this value to a whole number between 1 and 100, inclusive.
|
||||
|
||||
The default value is 75. You may override the default value in the [site configuration](#processing-options).
|
||||
The default value is 75. You may override the default value in the [site configuration].
|
||||
|
||||
```go-html-template
|
||||
{{ $image.Resize "600x webp q50" }}
|
||||
@@ -292,7 +298,7 @@ The default value is 75. You may override the default value in the [site configu
|
||||
|
||||
<!-- Specifies a libwebp preset, not a libwebp image hint. -->
|
||||
|
||||
Applicable to WebP images, this option corresponds to a set of pre-defined encoding parameters.
|
||||
Applicable to WebP images, this option corresponds to a set of predefined encoding parameters.
|
||||
|
||||
Value|Example
|
||||
:--|:--
|
||||
@@ -302,7 +308,7 @@ Value|Example
|
||||
`picture`|Indoor photograph such as a portrait
|
||||
`text`|Image that is primarily text
|
||||
|
||||
The default value is `photo`. You may override the default value in the [site configuration](#processing-options).
|
||||
The default value is `photo`. You may override the default value in the [site configuration].
|
||||
|
||||
```go-html-template
|
||||
{{ $image.Resize "600x webp picture" }}
|
||||
@@ -314,7 +320,7 @@ When converting an image from a format that supports transparency (e.g., PNG) to
|
||||
|
||||
Use either a 3-digit or a 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](#processing-options).
|
||||
The default value is `#ffffff` (white). You may override the default value in the [site configuration].
|
||||
|
||||
```go-html-template
|
||||
{{ $image.Resize "600x jpg #b31280" }}
|
||||
@@ -333,7 +339,7 @@ Filter|Description
|
||||
`Linear`|Bilinear resampling filter, produces smooth output, faster than cubic filters
|
||||
`NearestNeighbor`|Fastest resampling filter, no antialiasing
|
||||
|
||||
The default value is `Box`. You may override the default value in the [site configuration](#processing-options).
|
||||
The default value is `Box`. You may override the default value in the [site configuration].
|
||||
|
||||
```go-html-template
|
||||
{{ $image.Resize "600x400 Lanczos" }}
|
||||
@@ -360,10 +366,10 @@ _The photo of the sunset used in the examples below is Copyright [Bjørn Erik Pe
|
||||
This is the shortcode used to generate the examples above:
|
||||
|
||||
{{< code file="layouts/shortcodes/imgproc.html" >}}
|
||||
{{< readfile file="layouts/shortcodes/imgproc.html" >}}
|
||||
{{< readfile file="layouts/shortcodes/imgproc.html" >}}
|
||||
{{< /code >}}
|
||||
|
||||
Call the shortcode from your markdown like this:
|
||||
Call the shortcode from your Markdown like this:
|
||||
|
||||
```go-html-template
|
||||
{{</* imgproc sunset Resize "300x" /*/>}}
|
||||
@@ -460,3 +466,12 @@ hugo --gc
|
||||
[page bundle]: {{< relref "content-management/page-bundles" >}}
|
||||
[Smartcrop]: <https://github.com/muesli/smartcrop#smartcrop>
|
||||
[time.Format]: {{< relref "functions/dateformat" >}}
|
||||
[`Colors`]: #colors
|
||||
[`Crop`]: #crop
|
||||
[`Exif`]: #exif
|
||||
[`Fill`]: #fill
|
||||
[`Filter`]: #filter
|
||||
[`Fit`]: #fit
|
||||
[`Resize`]: #resize
|
||||
[site configuration]: #processing-options
|
||||
[`with`]: /functions/with/
|
||||
|
||||
@@ -1,20 +1,16 @@
|
||||
---
|
||||
title: Menus
|
||||
linktitle: Menus
|
||||
linkTitle: Menus
|
||||
description: Hugo has a simple yet powerful menu system.
|
||||
date: 2017-02-01
|
||||
publishdate: 2017-02-01
|
||||
lastmod: 2017-03-31
|
||||
categories: [content management]
|
||||
keywords: [menus]
|
||||
draft: false
|
||||
menu:
|
||||
docs:
|
||||
parent: "content-management"
|
||||
weight: 120
|
||||
weight: 120
|
||||
aliases: [/extras/menus/]
|
||||
parent: content-management
|
||||
weight: 190
|
||||
toc: true
|
||||
weight: 190
|
||||
aliases: [/extras/menus/]
|
||||
---
|
||||
|
||||
{{% note "Lazy Blogger"%}}
|
||||
@@ -69,7 +65,7 @@ menu:
|
||||
|
||||
## Add Non-content Entries to a Menu
|
||||
|
||||
You can also add entries to menus that aren’t attached to a piece of content. This takes place in your Hugo project's [`config` file][config].
|
||||
You can also add entries to menus that aren’t attached to a piece of content. This takes place in your Hugo project's [`config` file][config] (see [Menu Entry Properties][me-props] for full details of available variables).
|
||||
|
||||
Here’s an example snippet pulled from a configuration file:
|
||||
|
||||
|
||||
@@ -1,20 +1,16 @@
|
||||
---
|
||||
title: Multilingual Mode
|
||||
linktitle: Multilingual
|
||||
linkTitle: Multilingual
|
||||
description: Hugo supports the creation of websites with multiple languages side by side.
|
||||
date: 2017-01-10
|
||||
publishdate: 2017-01-10
|
||||
lastmod: 2017-01-10
|
||||
categories: [content management]
|
||||
keywords: [multilingual,i18n, internationalization]
|
||||
menu:
|
||||
docs:
|
||||
parent: "content-management"
|
||||
weight: 150
|
||||
weight: 150 #rem
|
||||
draft: false
|
||||
aliases: [/content/multilingual/,/tutorials/create-a-multilingual-site/]
|
||||
parent: content-management
|
||||
weight: 230
|
||||
toc: true
|
||||
weight: 230
|
||||
aliases: [/content/multilingual/,/tutorials/create-a-multilingual-site/]
|
||||
---
|
||||
|
||||
You should define the available languages in a `languages` section in your site configuration.
|
||||
@@ -60,7 +56,7 @@ weight = 3
|
||||
|
||||
Anything not defined in a `languages` block will fall back to the global value for that key (e.g., `copyright` for the English `en` language). This also works for `params`, as demonstrated with `help` above: You will get the value `Aide` in French and `Help` in all the languages without this parameter set.
|
||||
|
||||
With the configuration above, all content, sitemap, RSS feeds, paginations,
|
||||
With the configuration above, all content, sitemap, RSS feeds, pagination,
|
||||
and taxonomy pages will be rendered below `/` in English (your default content language) and then below `/fr` in French.
|
||||
|
||||
When working with front matter `Params` in [single page templates], omit the `params` in the key for the translation.
|
||||
@@ -230,7 +226,7 @@ If using `url`, remember to include the language part as well: `/fr/compagnie/a-
|
||||
|
||||
### Page Bundles
|
||||
|
||||
To avoid the burden of having to duplicate files, each Page Bundle inherits the resources of its linked translated pages' bundles except for the content files (markdown files, html files etc...).
|
||||
To avoid the burden of having to duplicate files, each Page Bundle inherits the resources of its linked translated pages' bundles except for the content files (Markdown files, HTML files etc...).
|
||||
|
||||
Therefore, from within a template, the page will have access to the files from all linked pages' bundles.
|
||||
|
||||
@@ -335,13 +331,13 @@ This article has 101 words.
|
||||
|
||||
### Query a singular/plural translation
|
||||
|
||||
In order to meet singular/plural requirement, you must pass a dictionary (map) with a numeric `.Count` property to the `i18n` function. The below example uses `.ReadingTime` variable which has a built-in `.Count` property.
|
||||
In other to meet singular/plural requirement, you must pass a dictionary (map) with a numeric `.Count` property to the `i18n` function. The below example uses `.ReadingTime` variable which has a built-in `.Count` property.
|
||||
|
||||
```go-html-template
|
||||
{{ i18n "readingTime" .ReadingTime }}
|
||||
```
|
||||
|
||||
The function will read `.Count` from `.ReadingTime` and evaluate where the number is singular (`one`) or plural (`other`). After that, it will pass to `readingTime` id:
|
||||
The function will read `.Count` from `.ReadingTime` and evaluate whether the number is singular (`one`) or plural (`other`). After that, it will pass to `readingTime` id in `i18n/en-US.toml` file:
|
||||
|
||||
{{< code-toggle file="i18n/en-US" >}}
|
||||
[readingTime]
|
||||
@@ -349,7 +345,7 @@ one = "One minute to read"
|
||||
other = "{{.Count}} minutes to read"
|
||||
{{< /code-toggle >}}
|
||||
|
||||
Assume `.ReadingTime.Count` in the context has value of 525600. The result will be:
|
||||
Assuming `.ReadingTime.Count` in the context has value is 525600. The result will be:
|
||||
|
||||
```text
|
||||
525600 minutes to read
|
||||
@@ -361,7 +357,7 @@ If `.ReadingTime.Count` in the context has value is 1. The result is:
|
||||
One minute to read
|
||||
```
|
||||
|
||||
In case you need to pass custom data: (`(dict "Count" 25)` is minimum requirement)
|
||||
In case you need to pass a custom data: (`(dict "Count" numeric_value_only)` is minimum requirement)
|
||||
|
||||
```go-html-template
|
||||
{{ i18n "readingTime" (dict "Count" 25 "FirstArgument" true "SecondArgument" false "Etc" "so on, so far") }}
|
||||
@@ -507,6 +503,40 @@ The rendering of the main navigation works as usual. `.Site.Menus` will just con
|
||||
</ul>
|
||||
```
|
||||
|
||||
### Dynamically localizing menus with i18n
|
||||
|
||||
While customizing menus per language is useful, your config file can become hard to maintain if you have a lot of languages
|
||||
|
||||
If your menus are the same in all languages (ie. if the only thing that changes is the translated name) you can use the `.Identifier` as a translation key for the menu name:
|
||||
|
||||
{{< code-toggle file="config" >}}
|
||||
[[menu.main]]
|
||||
name = "About me"
|
||||
url = "about"
|
||||
weight = 1
|
||||
identifier = "about"
|
||||
{{< /code-toggle >}}
|
||||
|
||||
You now need to specify the translations for the menu keys in the i18n files:
|
||||
|
||||
{{< code file="i18n/pt.toml" >}}
|
||||
[about]
|
||||
other="Sobre mim"
|
||||
{{< /code >}}
|
||||
|
||||
And do the appropriate changes in the menu code to use the `i18n` tag with the `.Identifier` as a key. You will also note that here we are using a `default` to fall back to `.Name`, in case the `.Identifier` key is also not present in the language specified in the `defaultContentLanguage` configuration.
|
||||
|
||||
{{< code file="layouts/partials/menu.html" >}}
|
||||
<ul>
|
||||
{{- $currentPage := . -}}
|
||||
{{ range .Site.Menus.main -}}
|
||||
<li class="{{ if $currentPage.IsMenuCurrent "main" . }}active{{ end }}">
|
||||
<a href="{{ .URL | absLangURL }}">{{ i18n .Identifier | default .Name}}</a>
|
||||
</li>
|
||||
{{- end }}
|
||||
</ul>
|
||||
{{< /code >}}
|
||||
|
||||
## Missing Translations
|
||||
|
||||
If a string does not have a translation for the current language, Hugo will use the value from the default language. If no default value is set, an empty string will be shown.
|
||||
@@ -535,6 +565,11 @@ To support Multilingual mode in your themes, some considerations must be taken f
|
||||
|
||||
If there is more than one language defined, the `LanguagePrefix` variable will equal `/en` (or whatever your `CurrentLanguage` is). If not enabled, it will be an empty string (and is therefore harmless for single-language Hugo websites).
|
||||
|
||||
|
||||
## Generate multilingual content with `hugo new`
|
||||
|
||||
Currently, `hugo new` is not ready to support generating multilingual content. But there is a [proposal topic](https://github.com/gohugoio/hugo/issues/7732) about this in GitHub issue to discuss how it should work.
|
||||
|
||||
[abslangurl]: /functions/abslangurl
|
||||
[config]: /getting-started/configuration/
|
||||
[contenttemplate]: /templates/single-page-templates/
|
||||
|
||||
@@ -1,20 +1,16 @@
|
||||
---
|
||||
title: Content Organization
|
||||
linktitle: Organization
|
||||
linkTitle: Organization
|
||||
description: Hugo assumes that the same structure that works to organize your source content is used to organize the rendered site.
|
||||
date: 2017-02-01
|
||||
publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
categories: [content management,fundamentals]
|
||||
keywords: [sections,content,organization,bundle,resources]
|
||||
menu:
|
||||
docs:
|
||||
parent: "content-management"
|
||||
weight: 10
|
||||
weight: 10 #rem
|
||||
draft: false
|
||||
aliases: [/content/sections/]
|
||||
parent: content-management
|
||||
weight: 20
|
||||
toc: true
|
||||
weight: 20
|
||||
aliases: [/content/sections/]
|
||||
---
|
||||
|
||||
## Page Bundles
|
||||
@@ -35,14 +31,13 @@ The bundle documentation is a **work in progress**. We will publish more compreh
|
||||
|
||||
## Organization of Content Source
|
||||
|
||||
|
||||
In Hugo, your content should be organized in a manner that reflects the rendered website.
|
||||
|
||||
While Hugo supports content nested at any level, the top levels (i.e. `content/<DIRECTORIES>`) are special in Hugo and are considered the content type used to determine layouts etc. To read more about sections, including how to nest them, see [sections][].
|
||||
|
||||
Without any additional configuration, the following will automatically work:
|
||||
|
||||
```
|
||||
```txt
|
||||
.
|
||||
└── content
|
||||
└── about
|
||||
@@ -73,7 +68,7 @@ The following demonstrates the relationships between your content organization a
|
||||
You can create one `_index.md` for your homepage and one in each of your content sections, taxonomies, and taxonomy terms. The following shows typical placement of an `_index.md` that would contain content and front matter for a `posts` section list page on a Hugo website:
|
||||
|
||||
|
||||
```
|
||||
```txt
|
||||
. url
|
||||
. ⊢--^-⊣
|
||||
. path slug
|
||||
@@ -85,7 +80,7 @@ content/posts/_index.md
|
||||
|
||||
At build, this will output to the following destination with the associated values:
|
||||
|
||||
```
|
||||
```txt
|
||||
|
||||
url ("/posts/")
|
||||
⊢-^-⊣
|
||||
@@ -104,7 +99,7 @@ The [sections] can be nested as deeply as you want. The important thing to under
|
||||
Single content files in each of your sections will be rendered as [single page templates][singles]. Here is an example of a single `post` within `posts`:
|
||||
|
||||
|
||||
```
|
||||
```txt
|
||||
path ("posts/my-first-hugo-post.md")
|
||||
. ⊢-----------^------------⊣
|
||||
. section slug
|
||||
@@ -114,7 +109,7 @@ content/posts/my-first-hugo-post.md
|
||||
|
||||
When Hugo builds your site, the content will be output to the following destination:
|
||||
|
||||
```
|
||||
```txt
|
||||
|
||||
url ("/posts/my-first-hugo-post/")
|
||||
⊢------------^----------⊣
|
||||
@@ -180,7 +175,7 @@ slug: "new-post"
|
||||
|
||||
This will render to the following destination according to Hugo's default behavior:
|
||||
|
||||
```
|
||||
```txt
|
||||
example.com/posts/new-post/
|
||||
```
|
||||
|
||||
@@ -217,7 +212,7 @@ url: /blog/new-url/
|
||||
|
||||
Assuming your `baseURL` is [configured][config] to `https://example.com`, the addition of `url` to the front matter will make `old-url.md` render to the following destination:
|
||||
|
||||
```
|
||||
```txt
|
||||
https://example.com/blog/new-url/
|
||||
```
|
||||
|
||||
|
||||
@@ -1,16 +1,17 @@
|
||||
---
|
||||
title : "Page Bundles"
|
||||
description : "Content organization using Page Bundles"
|
||||
date : 2018-01-24T13:09:00-05:00
|
||||
linktitle : "Page Bundles"
|
||||
keywords : ["page", "bundle", "leaf", "branch"]
|
||||
categories : ["content management"]
|
||||
toc : true
|
||||
title: Page Bundles
|
||||
linkTitle: Page Bundles
|
||||
description: Content organization using Page Bundles
|
||||
linkTitle: Page Bundles
|
||||
keywords: [page, bundle, leaf, branch]
|
||||
categories: [content management]
|
||||
menu :
|
||||
docs:
|
||||
identifier : "page-bundles"
|
||||
parent : "content-management"
|
||||
weight : 11
|
||||
identifier: "page-bundles"
|
||||
parent: "content-management"
|
||||
weight: 30
|
||||
toc: true
|
||||
weight: 30
|
||||
---
|
||||
|
||||
Page Bundles are a way to group [Page Resources](/content-management/page-resources/).
|
||||
@@ -23,8 +24,8 @@ 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 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 |
|
||||
| Index filename | `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` | `list` |
|
||||
| Nesting | Does not allow nesting of more bundles under it | Allows nesting of leaf or branch bundles under it |
|
||||
@@ -64,26 +65,27 @@ content/
|
||||
In the above example `content/` directory, there are four leaf
|
||||
bundles:
|
||||
|
||||
about
|
||||
`about`
|
||||
: This leaf bundle is at the root level (directly under
|
||||
`content` directory) and has only the `index.md`.
|
||||
|
||||
my-post
|
||||
`my-post`
|
||||
: This leaf bundle has the `index.md`, two other content
|
||||
Markdown files and two image files.
|
||||
|
||||
image1
|
||||
: This image is a page resource of `my-post`
|
||||
- image1, image2:
|
||||
These images are page resources of `my-post`
|
||||
and only available in `my-post/index.md` resources.
|
||||
|
||||
image2
|
||||
: This image is a page resource of `my-post`
|
||||
- content1, content2:
|
||||
These content files are page resources of `my-post`
|
||||
and only available in `my-post/index.md` resources.
|
||||
They will **not** be rendered as individual pages.
|
||||
|
||||
my-other-post
|
||||
`my-other-post`
|
||||
: This leaf bundle has only the `index.md`.
|
||||
|
||||
another-leaf-bundle
|
||||
`another-leaf-bundle`
|
||||
: This leaf bundle is nested under couple of
|
||||
directories. This bundle also has only the `index.md`.
|
||||
|
||||
@@ -98,8 +100,8 @@ as long as it is not inside another **leaf** bundle.
|
||||
A headless bundle is a bundle that is configured to not get published
|
||||
anywhere:
|
||||
|
||||
- It will have no `Permalink` and no rendered HTML in `public/`.
|
||||
- It will not be part of `.Site.RegularPages`, etc.
|
||||
- It will have no `Permalink` and no rendered HTML in `public/`.
|
||||
- It will not be part of `.Site.RegularPages`, etc.
|
||||
|
||||
But you can get it by `.Site.GetPage`. Here is an example:
|
||||
|
||||
@@ -120,9 +122,9 @@ _In this example, we are assuming the `some-headless-bundle` to be a headless
|
||||
Explanation of the above example:
|
||||
|
||||
1. Get the `some-headless-bundle` Page "object".
|
||||
2. Collect a *slice* of resources in this *Page Bundle* that matches
|
||||
2. Collect a _slice_ of resources in this _Page Bundle_ that matches
|
||||
`"author*"` using `.Resources.Match`.
|
||||
3. Loop through that *slice* of nested pages, and output their `.Title` and
|
||||
3. Loop through that _slice_ of nested pages, and output their `.Title` and
|
||||
`.Content`.
|
||||
|
||||
---
|
||||
@@ -136,9 +138,8 @@ headless = true
|
||||
|
||||
There are many use cases of such headless page bundles:
|
||||
|
||||
- Shared media galleries
|
||||
- Reusable page content "snippets"
|
||||
|
||||
- Shared media galleries
|
||||
- Reusable page content "snippets"
|
||||
|
||||
## Branch Bundles {#branch-bundles}
|
||||
|
||||
|
||||
@@ -1,17 +1,15 @@
|
||||
---
|
||||
title : "Page Resources"
|
||||
description : "Page resources -- images, other pages, documents, etc. -- have page-relative URLs and their own metadata."
|
||||
date: 2018-01-24
|
||||
categories: ["content management"]
|
||||
title: Page Resources
|
||||
linkTitle: Page Resources
|
||||
description: Page resources -- images, other pages, documents, etc. -- have page-relative URLs and their own metadata.
|
||||
categories: [content management]
|
||||
keywords: [bundle,content,resources]
|
||||
weight: 4003
|
||||
draft: false
|
||||
toc: true
|
||||
linktitle: "Page Resources"
|
||||
menu:
|
||||
docs:
|
||||
parent: "content-management"
|
||||
weight: 31
|
||||
parent: content-management
|
||||
weight: 80
|
||||
toc: true
|
||||
weight: 80
|
||||
---
|
||||
Page resources are only accessible from [page bundles]({{< relref
|
||||
"/content-management/page-bundles" >}}), those directories with `index.md` or
|
||||
@@ -45,8 +43,6 @@ content
|
||||
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`.
|
||||
|
||||
{{< new-in "0.80.0" >}} Note that we in Hugo `v0.80.0` fixed a bug where non-image resources (e.g. video) would return the MIME sub type, e.g. `json`.
|
||||
|
||||
Name
|
||||
: Default value is the filename (relative to the owning page). Can be set in front matter.
|
||||
|
||||
@@ -90,16 +86,17 @@ MediaType.Suffixes
|
||||
: A slice of possible suffixes for the resource's MIME type.
|
||||
|
||||
## Methods
|
||||
|
||||
ByType
|
||||
: Returns the page resources of the given type.
|
||||
|
||||
```go
|
||||
```go-html-template
|
||||
{{ .Resources.ByType "image" }}
|
||||
```
|
||||
Match
|
||||
: Returns all the page resources (as a slice) whose `Name` matches the given Glob pattern ([examples](https://github.com/gobwas/glob/blob/master/readme.md)). The matching is case-insensitive.
|
||||
|
||||
```go
|
||||
```go-html-template
|
||||
{{ .Resources.Match "images/*" }}
|
||||
```
|
||||
|
||||
@@ -107,6 +104,7 @@ GetMatch
|
||||
: Same as `Match` but will return the first match.
|
||||
|
||||
### Pattern Matching
|
||||
|
||||
```go
|
||||
// Using Match/GetMatch to find this images/sunset.jpg ?
|
||||
.Resources.Match "images/sun*" ✅
|
||||
@@ -131,7 +129,7 @@ name
|
||||
: Sets the value returned in `Name`.
|
||||
|
||||
{{% warning %}}
|
||||
The methods `Match` and `GetMatch` use `Name` to match the resources.
|
||||
The methods `Match`, `Get` and `GetMatch` use `Name` to match the resources.
|
||||
{{%/ warning %}}
|
||||
|
||||
title
|
||||
@@ -140,8 +138,7 @@ title
|
||||
params
|
||||
: A map of custom key/values.
|
||||
|
||||
|
||||
### Resources metadata example
|
||||
### Resources metadata example
|
||||
|
||||
{{< code-toggle copy="false">}}
|
||||
title: Application
|
||||
|
||||
@@ -1,25 +1,22 @@
|
||||
---
|
||||
title: Related Content
|
||||
linkTitle: Related Content
|
||||
description: List related content in "See Also" sections.
|
||||
date: 2017-09-05
|
||||
categories: [content management]
|
||||
keywords: [content]
|
||||
menu:
|
||||
docs:
|
||||
parent: "content-management"
|
||||
weight: 40
|
||||
weight: 30
|
||||
draft: false
|
||||
aliases: [/content/related/,/related/]
|
||||
parent: content-management
|
||||
weight: 110
|
||||
toc: true
|
||||
weight: 110
|
||||
aliases: [/content/related/,/related/]
|
||||
---
|
||||
|
||||
|
||||
Hugo uses a set of factors to identify a page's related content based on Front Matter parameters. This can be tuned to the desired set of indices and parameters or left to Hugo's default [Related Content configuration](#configure-related-content).
|
||||
|
||||
## List Related Content
|
||||
|
||||
|
||||
To list up to 5 related pages (which share the same _date_ or _keyword_ parameters) is as simple as including something similar to this partial in your single page template:
|
||||
|
||||
{{< code file="layouts/partials/related.html" >}}
|
||||
@@ -27,9 +24,9 @@ To list up to 5 related pages (which share the same _date_ or _keyword_ paramete
|
||||
{{ with $related }}
|
||||
<h3>See Also</h3>
|
||||
<ul>
|
||||
{{ range . }}
|
||||
<li><a href="{{ .RelPermalink }}">{{ .Title }}</a></li>
|
||||
{{ end }}
|
||||
{{ range . }}
|
||||
<li><a href="{{ .RelPermalink }}">{{ .Title }}</a></li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
{{ end }}
|
||||
{{< /code >}}
|
||||
@@ -39,25 +36,28 @@ To list up to 5 related pages (which share the same _date_ or _keyword_ paramete
|
||||
Here is the list of "Related" methods available on a page collection such `.RegularPages`.
|
||||
|
||||
#### .Related PAGE
|
||||
|
||||
Returns a collection of pages related the given one.
|
||||
|
||||
```
|
||||
```go-html-template
|
||||
{{ $related := site.RegularPages.Related . }}
|
||||
```
|
||||
|
||||
#### .RelatedIndices PAGE INDICE1 [INDICE2 ...]
|
||||
|
||||
Returns a collection of pages related to a given one restricted to a list of indices.
|
||||
|
||||
```
|
||||
```go-html-template
|
||||
{{ $related := site.RegularPages.RelatedIndices . "tags" "date" }}
|
||||
```
|
||||
|
||||
#### .RelatedTo KEYVALS [KEYVALS2 ...]
|
||||
|
||||
Returns a collection of pages related together by a set of indices and their match.
|
||||
|
||||
In order to build those set and pass them as argument, one must use the `keyVals` function where the first argument would be the `indice` and the consecutive ones its potential `matches`.
|
||||
|
||||
```
|
||||
```go-html-template
|
||||
{{ $related := site.RegularPages.RelatedTo ( keyVals "tags" "hugo" "rocks") ( keyVals "date" .Date ) }}
|
||||
```
|
||||
|
||||
@@ -66,6 +66,7 @@ Read [this blog article](https://regisphilibert.com/blog/2018/04/hugo-optmized-r
|
||||
{{% /note %}}
|
||||
|
||||
## Configure Related Content
|
||||
|
||||
Hugo provides a sensible default configuration of Related Content, but you can fine-tune this in your configuration, on the global or language level if needed.
|
||||
|
||||
### Default configuration
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
title: Content Sections
|
||||
linktitle: Sections
|
||||
description: "Hugo generates a **section tree** that matches your content."
|
||||
linkTitle: Sections
|
||||
description: Hugo generates a **section tree** that matches your content.
|
||||
date: 2017-02-01
|
||||
publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
@@ -9,12 +9,11 @@ categories: [content management]
|
||||
keywords: [lists,sections,content types,organization]
|
||||
menu:
|
||||
docs:
|
||||
parent: "content-management"
|
||||
weight: 50
|
||||
weight: 50 #rem
|
||||
draft: false
|
||||
aliases: [/content/sections/]
|
||||
parent: content-management
|
||||
weight: 120
|
||||
toc: true
|
||||
weight: 120
|
||||
aliases: [/content/sections/]
|
||||
---
|
||||
|
||||
A **Section** is a collection of pages that gets defined based on the
|
||||
@@ -73,7 +72,7 @@ With the available [section variables and methods](#section-page-variables-and-m
|
||||
{{ else if not .p1.IsHome }}
|
||||
{{ template "breadcrumbnav" (dict "p1" .p1.Site.Home "p2" .p2 ) }}
|
||||
{{ end }}
|
||||
<li{{ if eq .p1 .p2 }} class="active"{{ end }}>
|
||||
<li{{ if eq .p1 .p2 }} class="active" aria-current="page" {{ end }}>
|
||||
<a href="{{ .p1.Permalink }}">{{ .p1.Title }}</a>
|
||||
</li>
|
||||
{{ end }}
|
||||
@@ -87,7 +86,7 @@ Also see [Page Variables](/variables/page/).
|
||||
|
||||
## Content Section Lists
|
||||
|
||||
Hugo will automatically create pages for each *root section* that list all of the content in that section. See the documentation on [section templates][] for details on customizing the way these pages are rendered.
|
||||
Hugo will automatically create a page for each *root section* that lists all the content in that section. See the documentation on [section templates][] for details on customizing the way these pages are rendered.
|
||||
|
||||
## Content *Section* vs Content *Type*
|
||||
|
||||
|
||||
@@ -1,21 +1,17 @@
|
||||
---
|
||||
title: Shortcodes
|
||||
linktitle:
|
||||
linkTitle: Shortcodes
|
||||
description: Shortcodes are simple snippets inside your content files calling built-in or custom templates.
|
||||
date: 2017-02-01
|
||||
publishdate: 2017-02-01
|
||||
lastmod: 2019-11-07
|
||||
menu:
|
||||
docs:
|
||||
parent: "content-management"
|
||||
weight: 35
|
||||
weight: 35 #rem
|
||||
categories: [content management]
|
||||
keywords: [markdown,content,shortcodes]
|
||||
draft: false
|
||||
menu:
|
||||
docs:
|
||||
parent: content-management
|
||||
weight: 100
|
||||
toc: true
|
||||
weight: 100
|
||||
aliases: [/extras/shortcodes/]
|
||||
testparam: "Hugo Rocks!"
|
||||
toc: true
|
||||
---
|
||||
|
||||
## What a Shortcode is
|
||||
@@ -40,11 +36,11 @@ Some shortcodes use or require closing shortcodes. Again like HTML, the opening
|
||||
|
||||
Here are two examples of paired shortcodes:
|
||||
|
||||
```
|
||||
```go-html-template
|
||||
{{%/* mdshortcode */%}}Stuff to `process` in the *center*.{{%/* /mdshortcode */%}}
|
||||
```
|
||||
|
||||
```
|
||||
```go-html-template
|
||||
{{</* highlight go */>}} A bunch of code here {{</* /highlight */>}}
|
||||
```
|
||||
|
||||
@@ -52,11 +48,9 @@ The examples above use two different delimiters, the difference being the `%` ch
|
||||
|
||||
### Shortcodes with raw string parameters
|
||||
|
||||
{{< new-in "0.64.1" >}}
|
||||
|
||||
You can pass multiple lines as parameters to a shortcode by using raw string literals:
|
||||
|
||||
```
|
||||
```go-html-template
|
||||
{{</* myshortcode `This is some <b>HTML</b>,
|
||||
and a new line with a "quoted string".` */>}}
|
||||
```
|
||||
@@ -67,16 +61,15 @@ In Hugo `0.55` we changed how the `%` delimiter works. Shortcodes using the `%`
|
||||
|
||||
If you want the old behavior, you can put the following line in the start of your shortcode template:
|
||||
|
||||
```
|
||||
```go-html-template
|
||||
{{ $_hugo_config := `{ "version": 1 }` }}
|
||||
```
|
||||
|
||||
|
||||
### Shortcodes Without Markdown
|
||||
|
||||
The `<` character indicates that the shortcode's inner content does *not* need further rendering. Often shortcodes without markdown include internal HTML:
|
||||
The `<` character indicates that the shortcode's inner content does *not* need further rendering. Often shortcodes without Markdown include internal HTML:
|
||||
|
||||
```
|
||||
```go-html-template
|
||||
{{</* myshortcode */>}}<p>Hello <strong>World!</strong></p>{{</* /myshortcode */>}}
|
||||
```
|
||||
|
||||
@@ -86,11 +79,11 @@ You can call shortcodes within other shortcodes by creating your own templates t
|
||||
|
||||
## Use Hugo's Built-in Shortcodes
|
||||
|
||||
Hugo ships with a set of predefined shortcodes that represent very common usage. These shortcodes are provided for author convenience and to keep your markdown content clean.
|
||||
Hugo ships with a set of predefined shortcodes that represent very common usage. These shortcodes are provided for author convenience and to keep your Markdown content clean.
|
||||
|
||||
### `figure`
|
||||
|
||||
`figure` is an extension of the image syntax in markdown, which does not provide a shorthand for the more semantic [HTML5 `<figure>` element][figureelement].
|
||||
`figure` is an extension of the image syntax in Markdown, which does not provide a shorthand for the more semantic [HTML5 `<figure>` element][figureelement].
|
||||
|
||||
The `figure` shortcode can use the following named parameters:
|
||||
|
||||
@@ -151,13 +144,13 @@ attrlink
|
||||
|
||||
Bloggers often want to include GitHub gists when writing posts. Let's suppose we want to use the [gist at the following url][examplegist]:
|
||||
|
||||
```
|
||||
```txt
|
||||
https://gist.github.com/spf13/7896402
|
||||
```
|
||||
|
||||
We can embed the gist in our content via username and gist ID pulled from the URL:
|
||||
|
||||
```
|
||||
```go-html-template
|
||||
{{</* gist spf13 7896402 */>}}
|
||||
```
|
||||
|
||||
@@ -177,7 +170,7 @@ If the gist contains several files and you want to quote just one of them, you c
|
||||
|
||||
#### Example `gist` Display
|
||||
|
||||
To demonstrate the remarkably efficiency of Hugo's shortcode feature, we have embedded the `spf13` `gist` example in this page. The following simulates the experience for visitors to your website. Naturally, the final display will be contingent on your stylesheets and surrounding markup.
|
||||
To demonstrate the remarkable efficiency of Hugo's shortcode feature, we have embedded the `spf13` `gist` example in this page. The following simulates the experience for visitors to your website. Naturally, the final display will depend on your stylesheets and surrounding markup.
|
||||
|
||||
{{< gist spf13 7896402 >}}
|
||||
|
||||
@@ -223,7 +216,7 @@ To see even more options for adding syntax-highlighted code blocks to your websi
|
||||
|
||||
If you'd like to embed a photo from [Instagram][], you only need the photo's ID. You can discern an Instagram photo ID from the URL:
|
||||
|
||||
```
|
||||
```txt
|
||||
https://www.instagram.com/p/BWNjjyYFxVx/
|
||||
```
|
||||
|
||||
@@ -249,19 +242,18 @@ By adding the preceding `hidecaption` example, the following HTML will be added
|
||||
|
||||
#### Example `instagram` Display
|
||||
|
||||
Using the preceding `instagram` with `hidecaption` example above, the following simulates the displayed experience for visitors to your website. Naturally, the final display will be contingent on your stylesheets and surrounding markup.
|
||||
Using the preceding `instagram` with `hidecaption` example above, the following simulates the displayed experience for visitors to your website. Naturally, the final display will be contingent on your style sheets and surrounding markup.
|
||||
|
||||
{{< instagram BWNjjyYFxVx hidecaption >}}
|
||||
|
||||
|
||||
|
||||
{{% note %}}
|
||||
The `instagram`-shortcode refers an endpoint of Instagram's API, that's deprecated since October 24th, 2020. Thus, no images can be fetched from this API endpoint, resulting in an error when the `instagram`-shortcode is used. For more information please have a look at GitHub issue [#7879](https://github.com/gohugoio/hugo/issues/7879).
|
||||
{{% /note %}}
|
||||
|
||||
### `param`
|
||||
|
||||
Gets a value from the current `Page's` params set in front matter, with a fall back to the site param value. It will log an `ERROR` if the param with the given key could not be found in either.
|
||||
Gets a value from the current `Page's` params set in front matter, with a fallback to the site param value. It will log an `ERROR` if the param with the given key could not be found in either.
|
||||
|
||||
```bash
|
||||
{{</* param testparam */>}}
|
||||
@@ -291,7 +283,7 @@ Read a more extensive description of `ref` and `relref` in the [cross references
|
||||
|
||||
#### Example `ref` and `relref` Input
|
||||
|
||||
```
|
||||
```go-html-template
|
||||
[Neat]({{</* ref "blog/neat.md" */>}})
|
||||
[Who]({{</* relref "about.md#who" */>}})
|
||||
```
|
||||
@@ -300,7 +292,7 @@ Read a more extensive description of `ref` and `relref` in the [cross references
|
||||
|
||||
Assuming that standard Hugo pretty URLs are turned on.
|
||||
|
||||
```
|
||||
```html
|
||||
<a href="https://example.com/blog/neat">Neat</a>
|
||||
<a href="/about/#who">Who</a>
|
||||
```
|
||||
@@ -309,13 +301,13 @@ Assuming that standard Hugo pretty URLs are turned on.
|
||||
|
||||
You want to include a single tweet into your blog post? Everything you need is the URL of the tweet:
|
||||
|
||||
```
|
||||
```txt
|
||||
https://twitter.com/SanDiegoZoo/status/1453110110599868418
|
||||
```
|
||||
|
||||
#### Example `tweet` Input
|
||||
|
||||
Pass the tweet's user (case-insensitive) and id from the URL as parameters to the `tweet` shortcode.
|
||||
Pass the tweet's user (case-insensitive) and ID from the URL as parameters to the `tweet` shortcode.
|
||||
|
||||
{{< code file="example-tweet-input.md" >}}
|
||||
{{</* tweet user="SanDiegoZoo" id="1453110110599868418" */>}}
|
||||
@@ -339,7 +331,7 @@ Using the preceding `tweet` example, the following simulates the displayed exper
|
||||
|
||||
Adding a video from [Vimeo][] is equivalent to the [YouTube Input shortcode][].
|
||||
|
||||
```
|
||||
```txt
|
||||
https://vimeo.com/channels/staffpicks/146022717
|
||||
```
|
||||
|
||||
@@ -360,9 +352,9 @@ Using the preceding `vimeo` example, the following HTML will be added to your re
|
||||
{{< /output >}}
|
||||
|
||||
{{% tip %}}
|
||||
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`.
|
||||
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 %}}
|
||||
@@ -377,11 +369,10 @@ Using the preceding `vimeo` example, the following simulates the displayed exper
|
||||
|
||||
The `youtube` shortcode embeds a responsive video player for [YouTube videos][]. Only the ID of the video is required, e.g.:
|
||||
|
||||
```
|
||||
```txt
|
||||
https://www.youtube.com/watch?v=w7Ft2ymGmfc
|
||||
```
|
||||
|
||||
|
||||
#### Example `youtube` Input
|
||||
|
||||
Copy the YouTube video ID that follows `v=` in the video's URL and pass it to the `youtube` shortcode:
|
||||
@@ -390,7 +381,7 @@ Copy the YouTube video ID that follows `v=` in the video's URL and pass it to th
|
||||
{{</* youtube w7Ft2ymGmfc */>}}
|
||||
{{< /code >}}
|
||||
|
||||
Furthermore, you can automatically start playback of the embedded video by setting the `autoplay` parameter to `true`. Remember that you can't mix named and unnamed parameters, so you'll need to assign the yet unnamed video id to the parameter `id`:
|
||||
Furthermore, you can automatically start playback of the embedded video by setting the `autoplay` parameter to `true`. Remember that you can't mix named and unnamed parameters, so you'll need to assign the yet unnamed video ID to the parameter `id`:
|
||||
|
||||
|
||||
{{< code file="example-youtube-input-with-autoplay.md" >}}
|
||||
@@ -403,7 +394,6 @@ For [accessibility reasons](https://dequeuniversity.com/tips/provide-iframe-titl
|
||||
{{</* youtube id="w7Ft2ymGmfc" title="A New Hugo Site in Under Two Minutes" */>}}
|
||||
{{< /code >}}
|
||||
|
||||
|
||||
#### Example `youtube` Output
|
||||
|
||||
Using the preceding `youtube` example, the following HTML will be added to your rendered website's markup:
|
||||
@@ -414,7 +404,7 @@ Using the preceding `youtube` example, the following HTML will be added to your
|
||||
|
||||
#### Example `youtube` Display
|
||||
|
||||
Using the preceding `youtube` example (without `autoplay="true"`), the following simulates the displayed experience for visitors to your website. Naturally, the final display will be contingent on your stylesheets and surrounding markup. The video is also include in the [Quick Start of the Hugo documentation][quickstart].
|
||||
Using the preceding `youtube` example (without `autoplay="true"`), the following simulates the displayed experience for visitors to your website. Naturally, the final display will be contingent on your style sheets and surrounding markup. The video is also include in the [Quick Start of the Hugo documentation][quickstart].
|
||||
|
||||
{{< youtube w7Ft2ymGmfc >}}
|
||||
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
---
|
||||
title: Static Files
|
||||
description: "Files that get served **statically** (as-is, no modification) on the site root."
|
||||
date: 2017-11-18
|
||||
linkTitle: Static Files
|
||||
description: Files that get served **statically** (as-is, no modification) on the site root.
|
||||
categories: [content management]
|
||||
keywords: [source, directories]
|
||||
menu:
|
||||
docs:
|
||||
parent: "content-management"
|
||||
weight: 130
|
||||
weight: 130 #rem
|
||||
aliases: [/static-files]
|
||||
parent: content-management
|
||||
weight: 200
|
||||
toc: true
|
||||
weight: 200
|
||||
aliases: [/static-files]
|
||||
---
|
||||
|
||||
By default, the `static/` directory in the site project is used for
|
||||
@@ -65,6 +65,5 @@ Note 2
|
||||
: The example above is a [multihost setup][]. In a regular setup, all
|
||||
the static directories will be available to all sites.
|
||||
|
||||
|
||||
[site config]: /getting-started/configuration/#all-configuration-settings
|
||||
[multihost setup]: /content-management/multilingual/#configure-multilingual-multihost
|
||||
|
||||
@@ -1,20 +1,16 @@
|
||||
---
|
||||
title: Content Summaries
|
||||
linktitle: Summaries
|
||||
linkTitle: Summaries
|
||||
description: Hugo generates summaries of your content.
|
||||
date: 2017-01-10
|
||||
publishdate: 2017-01-10
|
||||
lastmod: 2017-01-10
|
||||
categories: [content management]
|
||||
keywords: [summaries,abstracts,read more]
|
||||
menu:
|
||||
docs:
|
||||
parent: "content-management"
|
||||
weight: 90
|
||||
weight: 90 #rem
|
||||
draft: false
|
||||
aliases: [/content/summaries/,/content-management/content-summaries/]
|
||||
parent: content-management
|
||||
weight: 160
|
||||
toc: true
|
||||
weight: 160
|
||||
aliases: [/content/summaries/,/content-management/content-summaries/]
|
||||
---
|
||||
|
||||
With the use of the `.Summary` [page variable][pagevariables], Hugo generates summaries of content to use as a short version in summary views.
|
||||
@@ -41,9 +37,9 @@ The Hugo-defined summaries are set to use word count calculated by splitting the
|
||||
|
||||
### Manual Summary Splitting
|
||||
|
||||
Alternatively, you may add the <code><!--more--></code> summary divider where you want to split the article.
|
||||
Alternatively, you may add the <code><!--more--></code> summary divider where you want to split the article.
|
||||
|
||||
For [Org mode content][org], use `# more` where you want to split the article.
|
||||
For [Org mode content][org], use `# more` where you want to split the article.
|
||||
|
||||
Content that comes before the summary divider will be used as that content's summary and stored in the `.Summary` page variable with all HTML formatting intact.
|
||||
|
||||
|
||||
@@ -1,22 +1,19 @@
|
||||
---
|
||||
title: Syntax Highlighting
|
||||
linkTitle: Syntax Highlighting
|
||||
description: Hugo comes with really fast syntax highlighting from Chroma.
|
||||
date: 2017-02-01
|
||||
publishdate: 2017-02-01
|
||||
keywords: [highlighting,chroma,code blocks,syntax]
|
||||
categories: [content management]
|
||||
menu:
|
||||
docs:
|
||||
parent: "content-management"
|
||||
weight: 300
|
||||
weight: 20
|
||||
sections_weight: 20
|
||||
draft: false
|
||||
aliases: [/extras/highlighting/,/extras/highlight/,/tools/syntax-highlighting/]
|
||||
parent: content-management
|
||||
weight: 240
|
||||
toc: true
|
||||
weight: 240
|
||||
aliases: [/extras/highlighting/,/extras/highlight/,/tools/syntax-highlighting/]
|
||||
---
|
||||
|
||||
Hugo uses [Chroma](https://github.com/alecthomas/chroma) as its code highlighter; it is built in Go and is really, really fast -- and for the most important parts compatible with Pygments we used before.
|
||||
Hugo uses [Chroma](https://github.com/alecthomas/chroma) as its code highlighter; it is built in Go and is really, really fast.
|
||||
|
||||
## Configure Syntax Highlighter
|
||||
|
||||
@@ -36,11 +33,11 @@ Run `hugo gen chromastyles -h` for more options. See https://xyproto.github.io/s
|
||||
|
||||
## Highlight Shortcode
|
||||
|
||||
Highlighting is carried out via the built-in [`highlight` shortcode](https://gohugo.io/content-management/shortcodes/#highlight). It takes exactly one required parameter for the programming language to be highlighted and requires a closing shortcode. Note that `highlight` is *not* used for client-side javascript highlighting.
|
||||
Highlighting is carried out via the built-in [`highlight` shortcode](https://gohugo.io/content-management/shortcodes/#highlight). It takes exactly one required parameter for the programming language to be highlighted and requires a closing shortcode.
|
||||
|
||||
Options:
|
||||
|
||||
* `linenos`: configure line numbers. Valid values are `true`, `false`, `table`, or `inline`. `false` will turn off line numbers if it's configured to be on in site config. {{< new-in "0.60.0" >}} `table` will give copy-and-paste friendly code blocks.
|
||||
* `linenos`: configure line numbers. Valid values are `true`, `false`, `table`, or `inline`. `false` will turn off line numbers if it's configured to be on in site config. `table` will give copy-and-paste friendly code blocks.
|
||||
* `hl_lines`: lists a set of line numbers or line number ranges to be highlighted.
|
||||
* `linenostart=199`: starts the line number count from 199.
|
||||
* `anchorlinenos`: Configure anchors on line numbers. Valid values are `true` or `false`;
|
||||
@@ -49,7 +46,7 @@ Options:
|
||||
|
||||
### Example: Highlight Shortcode
|
||||
|
||||
```
|
||||
```go-html-template
|
||||
{{</* highlight go "linenos=table,hl_lines=8 15-17,linenostart=199" */>}}
|
||||
// ... code
|
||||
{{</* / highlight */>}}
|
||||
@@ -80,15 +77,29 @@ func GetTitleFunc(style string) func(s string) string {
|
||||
}
|
||||
{{< / highlight >}}
|
||||
|
||||
## Highlight Hugo/GO Template Code
|
||||
|
||||
For highlighting Hugo/GO template code on your page, add `/*` after the opening double curly braces and `*/` before closing curly braces.
|
||||
|
||||
``` go
|
||||
{{</*/* myshortcode */*/>}}
|
||||
```
|
||||
|
||||
Gives this:
|
||||
|
||||
``` go
|
||||
{{</* myshortcode */>}}
|
||||
```
|
||||
|
||||
## Highlight Template Func
|
||||
|
||||
See [Highlight](/functions/highlight/).
|
||||
|
||||
## Highlighting in Code Fences
|
||||
|
||||
Highlighting in code fences is enabled by default.{{< new-in "0.60.0" >}}
|
||||
Highlighting in code fences is enabled by default.
|
||||
|
||||
````
|
||||
````txt
|
||||
```go {linenos=table,hl_lines=[8,"15-17"],linenostart=199}
|
||||
// ... code
|
||||
```
|
||||
@@ -120,8 +131,6 @@ func GetTitleFunc(style string) func(s string) string {
|
||||
}
|
||||
```
|
||||
|
||||
{{< new-in "0.60.0" >}}Note that only Goldmark supports passing attributes such as `hl_lines`, and it's important that it does not contain any spaces. See [goldmark-highlighting](https://github.com/yuin/goldmark-highlighting) for more information.
|
||||
|
||||
The options are the same as in the [highlighting shortcode](/content-management/syntax-highlighting/#highlight-shortcode),including `linenos=false`, but note the slightly different Markdown attribute syntax.
|
||||
|
||||
## List of Chroma Highlighting Languages
|
||||
@@ -129,11 +138,3 @@ The options are the same as in the [highlighting shortcode](/content-management/
|
||||
The full list of Chroma lexers and their aliases (which is the identifier used in the `highlight` template func or when doing highlighting in code fences):
|
||||
|
||||
{{< chroma-lexers >}}
|
||||
|
||||
[Prism]: https://prismjs.com
|
||||
[prismdownload]: https://prismjs.com/download.html
|
||||
[Highlight.js]: https://highlightjs.org/
|
||||
[Rainbow]: https://craig.is/making/rainbows
|
||||
[Syntax Highlighter]: https://alexgorbatchev.com/SyntaxHighlighter/
|
||||
[Google Prettify]: https://github.com/google/code-prettify
|
||||
[Yandex]: https://yandex.ru/
|
||||
|
||||
@@ -1,19 +1,16 @@
|
||||
---
|
||||
title: Taxonomies
|
||||
linktitle:
|
||||
linkTitle: Taxonomies
|
||||
description: Hugo includes support for user-defined taxonomies.
|
||||
date: 2017-02-01
|
||||
publishdate: 2017-02-01
|
||||
keywords: [taxonomies,metadata,front matter,terms]
|
||||
categories: [content management]
|
||||
menu:
|
||||
docs:
|
||||
parent: "content-management"
|
||||
weight: 80
|
||||
weight: 80 #rem
|
||||
draft: false
|
||||
aliases: [/taxonomies/overview/,/taxonomies/usage/,/indexes/overview/,/doc/indexes/,/extras/indexes]
|
||||
parent: content-management
|
||||
weight: 150
|
||||
toc: true
|
||||
weight: 150
|
||||
aliases: [/taxonomies/overview/,/taxonomies/usage/,/indexes/overview/,/doc/indexes/,/extras/indexes]
|
||||
---
|
||||
|
||||
## What is a Taxonomy?
|
||||
@@ -49,7 +46,7 @@ Then, in each of the movies, you would specify terms for each of these taxonomie
|
||||
|
||||
To continue with the example of a movie site, the following demonstrates content relationships from the perspective of the taxonomy:
|
||||
|
||||
```
|
||||
```txt
|
||||
Actor <- Taxonomy
|
||||
Bruce Willis <- Term
|
||||
The Sixth Sense <- Value
|
||||
@@ -63,7 +60,7 @@ Actor <- Taxonomy
|
||||
|
||||
From the perspective of the content, the relationships would appear differently, although the data and labels used are the same:
|
||||
|
||||
```
|
||||
```txt
|
||||
Unbreakable <- Value
|
||||
Actors <- Taxonomy
|
||||
Bruce Willis <- Term
|
||||
@@ -98,8 +95,6 @@ If you do not want Hugo to create any taxonomies, set `disableKinds` in your [si
|
||||
disableKinds = ["taxonomy","term"]
|
||||
{{</ code-toggle >}}
|
||||
|
||||
{{< new-in "0.73.0" >}} We have fixed the before confusing page kinds used for taxonomies (see the listing below) to be in line with the terms used when we talk about taxonomies. We have been careful to avoid site breakage, and you should get an ERROR in the console if you need to adjust your `disableKinds` section.
|
||||
|
||||
{{% page-kinds %}}
|
||||
|
||||
### Default Destinations
|
||||
@@ -111,7 +106,7 @@ When taxonomies are used---and [taxonomy templates][] are provided---Hugo will a
|
||||
|
||||
## Configure Taxonomies
|
||||
|
||||
Custom taxonomies other than the [defaults](#default-taxonomies) must be defined in your [site config][config] before they can be used throughout the site. You need to provide both the plural and singular labels for each taxonomy. For example, `singular key = "plural value"` for TOML and `singular key: "plural value"` for YAML.
|
||||
Custom taxonomies other than the [defaults]({{< relref "taxonomies.md#default-taxonomies" >}}) must be defined in your [site config][config] before they can be used throughout the site. You need to provide both the plural and singular labels for each taxonomy. For example, `singular key = "plural value"` for TOML and `singular key: "plural value"` for YAML.
|
||||
|
||||
### Example: Adding a custom taxonomy named "series"
|
||||
|
||||
@@ -135,7 +130,7 @@ If you want to have just the default `tags` taxonomy, and remove the `categories
|
||||
tag = "tags"
|
||||
{{</ code-toggle >}}
|
||||
|
||||
If you want to disable all taxonomies altogether, see the use of `disableKinds` in [Hugo Taxonomy Defaults](#default-taxonomies).
|
||||
If you want to disable all taxonomies altogether, see the use of `disableKinds` in [Hugo Taxonomy Defaults]({{< relref "taxonomies.md#default-taxonomies" >}}).
|
||||
|
||||
{{% note %}}
|
||||
You can add content and front matter to your taxonomy list and taxonomy terms pages. See [Content Organization](/content-management/organization/) for more information on how to add an `_index.md` for this purpose.
|
||||
@@ -174,7 +169,7 @@ project_url = "https://github.com/gohugoio/hugo"
|
||||
|
||||
A content file can assign weight for each of its associate taxonomies. Taxonomic weight can be used for sorting or ordering content in [taxonomy list templates][] and is declared in a content file's [front matter][]. The convention for declaring taxonomic weight is `taxonomyname_weight`.
|
||||
|
||||
The following TOML and YAML examples show a piece of content that has a weight of 22, which can be used for ordering purposes when rendering the pages assigned to the "a", "b" and "c" values of the `tags` taxonomy. It has also been assigned the weight of 44 when rendering the "d" category page.
|
||||
The following show a piece of content that has a weight of 22, which can be used for ordering purposes when rendering the pages assigned to the "a", "b" and "c" values of the `tags` taxonomy. It has also been assigned the weight of 44 when rendering the "d" category page.
|
||||
|
||||
### Example: Taxonomic `weight`
|
||||
|
||||
@@ -194,7 +189,7 @@ Currently taxonomies only support the [default `weight => date` ordering of list
|
||||
|
||||
## Add custom metadata to a Taxonomy or Term
|
||||
|
||||
If you need to add custom metadata to your taxonomy terms, you will need to create a page for that term at `/content/<TAXONOMY>/<TERM>/_index.md` and add your metadata in it's front matter. Continuing with our 'Actors' example, let's say you want to add a Wikipedia page link to each actor. Your terms pages would be something like this:
|
||||
If you need to add custom metadata to your taxonomy terms, you will need to create a page for that term at `/content/<TAXONOMY>/<TERM>/_index.md` and add your metadata in its front matter. Continuing with our 'Actors' example, let's say you want to add a Wikipedia page link to each actor. Your terms pages would be something like this:
|
||||
|
||||
{{< code file="/content/actors/bruce-willis/_index.md" >}}
|
||||
---
|
||||
|
||||
@@ -1,20 +1,16 @@
|
||||
---
|
||||
title: Table of Contents
|
||||
linktitle:
|
||||
linkTitle: Table of Contents
|
||||
description: Hugo can automatically parse Markdown content and create a Table of Contents you can use in your templates.
|
||||
date: 2017-02-01
|
||||
publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
categories: [content management]
|
||||
keywords: [table of contents, toc]
|
||||
menu:
|
||||
docs:
|
||||
parent: "content-management"
|
||||
weight: 130
|
||||
weight: 130 #rem
|
||||
draft: false
|
||||
aliases: [/extras/toc/]
|
||||
parent: content-management
|
||||
weight: 210
|
||||
toc: true
|
||||
weight: 210
|
||||
aliases: [/extras/toc/]
|
||||
---
|
||||
|
||||
{{% note "TOC Heading Levels are Fixed" %}}
|
||||
@@ -27,9 +23,9 @@ Hugo [v0.60.0](https://github.com/gohugoio/hugo/releases/tag/v0.60.0) made a swi
|
||||
|
||||
## Usage
|
||||
|
||||
Create your markdown the way you normally would with the appropriate headings. Here is some example content:
|
||||
Create your Markdown the way you normally would with the appropriate headings. Here is some example content:
|
||||
|
||||
```
|
||||
```md
|
||||
<!-- Your front matter up here -->
|
||||
|
||||
## Introduction
|
||||
|
||||
@@ -1,24 +1,21 @@
|
||||
---
|
||||
title: Content Types
|
||||
linkTitle: Content Types
|
||||
description: Hugo is built around content organized in sections.
|
||||
date: 2017-02-01
|
||||
categories: [content management]
|
||||
keywords: [lists,sections,content types,types,organization]
|
||||
keywords: [lists, sections, content types, types, organization]
|
||||
menu:
|
||||
docs:
|
||||
parent: "content-management"
|
||||
weight: 60
|
||||
weight: 60 #rem
|
||||
draft: false
|
||||
aliases: [/content/types]
|
||||
parent: content-management
|
||||
weight: 130
|
||||
toc: true
|
||||
weight: 130
|
||||
aliases: [/content/types]
|
||||
---
|
||||
|
||||
A **content type** is a way to organize your content. Hugo resolves the content type from either the `type` in front matter or, if not set, the first directory in the file path. E.g. `content/blog/my-first-event.md` will be of type `blog` if no `type` is set.
|
||||
|
||||
A content type is used to
|
||||
|
||||
* Determine how the content is rendered. See [Template Lookup Order](/templates/lookup-order/) and [Content Views](https://gohugo.io/templates/views) for more.
|
||||
* Determine which [archetype](/content-management/archetypes/) template to use for new content.
|
||||
|
||||
|
||||
- Determine how the content is rendered. See [Template Lookup Order](/templates/lookup-order/) and [Content Views](https://gohugo.io/templates/views) for more.
|
||||
- Determine which [archetype](/content-management/archetypes/) template to use for new content.
|
||||
|
||||
@@ -1,20 +1,16 @@
|
||||
---
|
||||
title: URL Management
|
||||
linktitle: URL Management
|
||||
linkTitle: URL Management
|
||||
description: Hugo supports permalinks, aliases, link canonicalization, and multiple options for handling relative vs absolute URLs.
|
||||
date: 2017-02-01
|
||||
publishdate: 2017-02-01
|
||||
lastmod: 2017-03-09
|
||||
keywords: [aliases,redirects,permalinks,urls]
|
||||
categories: [content management]
|
||||
keywords: [aliases,redirects,permalinks,urls]
|
||||
menu:
|
||||
docs:
|
||||
parent: "content-management"
|
||||
weight: 110
|
||||
weight: 110 #rem
|
||||
draft: false
|
||||
aliases: [/extras/permalinks/,/extras/aliases/,/extras/urls/,/doc/redirects/,/doc/alias/,/doc/aliases/]
|
||||
parent: content-management
|
||||
weight: 180
|
||||
toc: true
|
||||
weight: 180
|
||||
aliases: [/extras/permalinks/,/extras/aliases/,/extras/urls/,/doc/redirects/,/doc/alias/,/doc/aliases/]
|
||||
---
|
||||
|
||||
## Permalinks
|
||||
@@ -45,7 +41,7 @@ permalinks:
|
||||
/: /:year/:month/:filename/
|
||||
{{< /code-toggle >}}
|
||||
|
||||
If the standard date-based permalink configuration does not meet your needs, you can also format URL segments using [Go time formatting directives](https://golang.org/pkg/time/#Time.Format). For example, a URL structure with two digit years and month and day digits without zero padding can be accomplished with:
|
||||
If the standard date-based permalink configuration does not meet your needs, you can also format URL segments using [Go time formatting directives](https://pkg.go.dev/time#Time.Format). For example, a URL structure with two digit years and month and day digits without zero padding can be accomplished with:
|
||||
|
||||
{{< code-toggle file="config" copy="false" >}}
|
||||
permalinks:
|
||||
@@ -83,7 +79,7 @@ The following is a list of values that can be used in a `permalink` definition i
|
||||
: the content's section
|
||||
|
||||
`:sections`
|
||||
: the content's sections hierarchy. {{< new-in "0.83.0" >}} Since Hugo 0.83 you can use a selection of the sections using _slice syntax_: `:sections[1:]` includes all but the first, `:sections[:last]` includes all but the last, `:sections[last]` includes only the last, `:sections[1:2]` includes section 2 and 3. Note that this slice access will not throw any out-of-bounds errors, so you don't have to be exact.
|
||||
: the content's sections hierarchy. Uou can use a selection of the sections using _slice syntax_: `:sections[1:]` includes all but the first, `:sections[:last]` includes all but the last, `:sections[last]` includes only the last, `:sections[1:2]` includes section 2 and 3. Note that this slice access will not throw any out-of-bounds errors, so you don't have to be exact.
|
||||
|
||||
`:title`
|
||||
: the content's title
|
||||
@@ -133,7 +129,7 @@ aliases:
|
||||
---
|
||||
{{< /code >}}
|
||||
|
||||
Now when you visit any of the locations specified in aliases---i.e., *assuming the same site domain*---you'll be redirected to the page they are specified on. For example, a visitor to `example.com/posts/my-original-url/` will be immediately redirected to `example.com/posts/my-awesome-post/`.
|
||||
Now when you visit any of the locations specified in aliases---i.e., _assuming the same site domain_---you'll be redirected to the page they are specified on. For example, a visitor to `example.com/posts/my-original-url/` will be immediately redirected to `example.com/posts/my-awesome-post/`.
|
||||
|
||||
### Example: Aliases in Multilingual
|
||||
|
||||
@@ -141,14 +137,14 @@ On [multilingual sites][multilingual], each translation of a post can have uniqu
|
||||
|
||||
In `/posts/my-new-post.es.md`:
|
||||
|
||||
```
|
||||
```md
|
||||
---
|
||||
aliases:
|
||||
- /es/posts/my-original-post/
|
||||
---
|
||||
```
|
||||
|
||||
From Hugo 0.55 you can also have page-relative aliases, so ` /es/posts/my-original-post/` can be simplified to the more portable `my-original-post/`
|
||||
From Hugo 0.55 you can also have page-relative aliases, so `/es/posts/my-original-post/` can be simplified to the more portable `my-original-post/`
|
||||
|
||||
### How Hugo Aliases Work
|
||||
|
||||
@@ -156,7 +152,7 @@ When aliases are specified, Hugo creates a directory to match the alias entry. I
|
||||
|
||||
For example, a content file at `posts/my-intended-url.md` with the following in the front matter:
|
||||
|
||||
```
|
||||
```yml
|
||||
---
|
||||
title: My New post
|
||||
aliases: [/posts/my-old-url/]
|
||||
@@ -165,7 +161,7 @@ aliases: [/posts/my-old-url/]
|
||||
|
||||
Assuming a `baseURL` of `example.com`, the contents of the auto-generated alias `.html` found at `https://example.com/posts/my-old-url/` will contain the following:
|
||||
|
||||
```
|
||||
```html
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
@@ -204,7 +200,7 @@ Hugo's default behavior is to render your content with "pretty" URLs. No non-sta
|
||||
|
||||
The following demonstrates the concept:
|
||||
|
||||
```
|
||||
```txt
|
||||
content/posts/_index.md
|
||||
=> example.com/posts/
|
||||
content/posts/post-1.md
|
||||
@@ -219,7 +215,7 @@ If you want a specific piece of content to have an exact URL, you can specify th
|
||||
|
||||
See [Content Organization][contentorg] for more details on paths.
|
||||
|
||||
```
|
||||
```txt
|
||||
.
|
||||
└── content
|
||||
└── about
|
||||
@@ -236,7 +232,7 @@ See [Content Organization][contentorg] for more details on paths.
|
||||
|
||||
Here's the same organization run with `hugo --uglyURLs`:
|
||||
|
||||
```
|
||||
```txt
|
||||
.
|
||||
└── content
|
||||
└── about
|
||||
@@ -251,7 +247,6 @@ Here's the same organization run with `hugo --uglyURLs`:
|
||||
└── second.md // <- https://example.com/quote/second.html
|
||||
```
|
||||
|
||||
|
||||
## Canonicalization
|
||||
|
||||
By default, all relative URLs encountered in the input are left unmodified, e.g. `/css/foo.css` would stay as `/css/foo.css`. The `canonifyURLs` field in your site `config` has a default value of `false`.
|
||||
@@ -268,13 +263,13 @@ In the May 2014 release of Hugo v0.11, the default value of `canonifyURLs` was s
|
||||
|
||||
To find out the current value of `canonifyURLs` for your website, you may use the handy `hugo config` command added in v0.13.
|
||||
|
||||
```
|
||||
```txt
|
||||
hugo config | grep -i canon
|
||||
```
|
||||
|
||||
Or, if you are on Windows and do not have `grep` installed:
|
||||
|
||||
```
|
||||
```txt
|
||||
hugo config | FINDSTR /I canon
|
||||
```
|
||||
|
||||
@@ -300,7 +295,6 @@ url: "custom/foo"
|
||||
---
|
||||
```
|
||||
|
||||
|
||||
## Relative URLs
|
||||
|
||||
By default, all relative URLs are left unchanged by Hugo, which can be problematic when you want to make your site browsable from a local file system.
|
||||
|
||||
@@ -4,7 +4,6 @@ linktitle: Development
|
||||
description: Hugo relies heavily on contributions from the open source community.
|
||||
date: 2017-02-01
|
||||
publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
categories: [contribute]
|
||||
keywords: [dev,open source]
|
||||
authors: [digitalcraftsman]
|
||||
@@ -14,7 +13,6 @@ menu:
|
||||
weight: 10
|
||||
weight: 10
|
||||
sections_weight: 10
|
||||
draft: false
|
||||
toc: true
|
||||
---
|
||||
|
||||
@@ -45,13 +43,13 @@ If you are having trouble following the installation guides for Go, check out [G
|
||||
|
||||
Once you're finished installing Go, let's confirm everything is working correctly. Open a terminal---or command line under Windows--and type the following:
|
||||
|
||||
```
|
||||
```txt
|
||||
go version
|
||||
```
|
||||
|
||||
You should see something similar to the following written to the console. Note that the version here reflects the most recent version of Go as of the last update for this page:
|
||||
|
||||
```
|
||||
```txt
|
||||
go version go1.12 darwin/amd64
|
||||
```
|
||||
|
||||
@@ -59,13 +57,13 @@ Next, make sure that you set up your `GOPATH` [as described in the installation
|
||||
|
||||
You can print the `GOPATH` with `echo $GOPATH`. You should see a non-empty string containing a valid path to your Go workspace; for example:
|
||||
|
||||
```
|
||||
```txt
|
||||
/Users/<yourusername>/Code/go
|
||||
```
|
||||
|
||||
### Install Go with Homebrew
|
||||
|
||||
If you are a MacOS user and have [Homebrew](https://brew.sh/) installed on your machine, installing Go is as simple as the following command:
|
||||
If you are a macOS user and have [Homebrew](https://brew.sh/) installed on your machine, installing Go is as simple as the following command:
|
||||
|
||||
{{< code file="install-go.sh" >}}
|
||||
brew install go
|
||||
@@ -87,7 +85,7 @@ You will need to have Git installed on your computer to contribute to Hugo devel
|
||||
|
||||
Git is a [version control system](https://en.wikipedia.org/wiki/Version_control) to track the changes of source code. Hugo depends on smaller third-party packages that are used to extend the functionality. We use them because we don't want to reinvent the wheel.
|
||||
|
||||
Go ships with a sub-command called `get` that will download these packages for us when we setup our working environment. The source code of the packages is tracked with Git. `get` will interact with the Git servers of the package hosters in order to fetch all dependencies.
|
||||
Go ships with a sub-command called `get` that will download these packages for us when we set up our working environment. The source code of the packages is tracked with Git. `get` will interact with the Git servers of the package hosters in order to fetch all dependencies.
|
||||
|
||||
Move back to the terminal and check if Git is already installed. Type in `git version` and press enter. You can skip the rest of this section if the command returned a version number. Otherwise [download](https://git-scm.com/downloads) the latest version of Git and follow this [installation guide](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git).
|
||||
|
||||
@@ -95,7 +93,7 @@ Finally, check again with `git version` if Git was installed successfully.
|
||||
|
||||
### Git Graphical Front Ends
|
||||
|
||||
There are several [GUI clients](https://git-scm.com/downloads/guis) that help you to operate Git. Not all are available for all operating systems and maybe differ in their usage. Because of this we will document how to use the command line, since the commands are the same everywhere.
|
||||
There are several [GUI clients](https://git-scm.com/downloads/guis) that help you to operate Git. Not all are available for all operating systems and maybe differ in their usage. Because of this we will document how to use the command-line, since the commands are the same everywhere.
|
||||
|
||||
### Install Hub on Your System (Optional)
|
||||
|
||||
@@ -103,19 +101,19 @@ Hub is a great tool for working with GitHub. The main site for it is [hub.github
|
||||
|
||||
On a Mac, you can install [Hub](https://github.com/github/hub) using [Homebrew](https://brew.sh):
|
||||
|
||||
```
|
||||
```txt
|
||||
brew install hub
|
||||
```
|
||||
|
||||
Now we'll create an [alias in Bash](https://tldp.org/LDP/abs/html/aliases.html) so that typing `git` actually runs `Hub`:
|
||||
|
||||
```
|
||||
```txt
|
||||
echo "alias git='hub'" >> ~/.bash_profile
|
||||
```
|
||||
|
||||
Confirm the installation:
|
||||
|
||||
```
|
||||
```txt
|
||||
git version 2.21.0
|
||||
hub version 2.10.0
|
||||
```
|
||||
@@ -134,26 +132,25 @@ We're going to clone the [master Hugo repository](https://github.com/gohugoio/hu
|
||||
|
||||
So, let's make a new directory and clone that master repository:
|
||||
|
||||
```
|
||||
```txt
|
||||
mkdir $HOME/src
|
||||
cd $HOME/src
|
||||
git clone https://github.com/gohugoio/hugo.git
|
||||
```
|
||||
|
||||
> Since Hugo 0.48, Hugo uses the Go Modules support built into Go 1.11 to build.
|
||||
> Since Hugo 0.48, Hugo uses the Go Modules support built into Go 1.11 to build.
|
||||
> The easiest is to clone Hugo in a directory outside of GOPATH
|
||||
|
||||
And then, install dependencies of Hugo by running the following in the cloned directory:
|
||||
|
||||
```
|
||||
```txt
|
||||
cd $HOME/src/hugo
|
||||
go install
|
||||
```
|
||||
|
||||
|
||||
Hugo relies on [mage](https://github.com/magefile/mage) for some convenient build and test targets. If you don't already have it, get it:
|
||||
|
||||
```
|
||||
```txt
|
||||
go install github.com/magefile/mage@latest
|
||||
```
|
||||
|
||||
@@ -169,19 +166,19 @@ Open the [Hugo repository](https://github.com/gohugoio/hugo) on GitHub and click
|
||||
|
||||

|
||||
|
||||
Now open your fork repository on GitHub and copy the remote url of your fork. You can choose between HTTPS and SSH as protocol that Git should use for the following operations. HTTPS works always [if you're not sure](https://help.github.com/articles/which-remote-url-should-i-use/).
|
||||
Now open your fork repository on GitHub and copy the remote URL of your fork. You can choose between HTTPS and SSH as protocol that Git should use for the following operations. HTTPS works always [if you're not sure](https://help.github.com/articles/which-remote-url-should-i-use/).
|
||||
|
||||

|
||||
|
||||
Switch back to the terminal and move into the directory of the cloned master repository from the last step.
|
||||
|
||||
```
|
||||
```txt
|
||||
cd $HOME/src/hugo
|
||||
```
|
||||
|
||||
Now Git needs to know that our fork exists by adding the copied remote url:
|
||||
|
||||
```
|
||||
```txt
|
||||
git remote add <YOUR-GITHUB-USERNAME> <COPIED REMOTE-URL>
|
||||
```
|
||||
|
||||
@@ -189,7 +186,7 @@ git remote add <YOUR-GITHUB-USERNAME> <COPIED REMOTE-URL>
|
||||
|
||||
Alternatively, you can use the Git wrapper Hub. Hub makes forking a repository easy:
|
||||
|
||||
```
|
||||
```txt
|
||||
git fork
|
||||
```
|
||||
|
||||
@@ -199,13 +196,13 @@ That command will log in to GitHub using your account, create a fork of the repo
|
||||
|
||||
Let's check if everything went right by listing all known remotes:
|
||||
|
||||
```
|
||||
```txt
|
||||
git remote -v
|
||||
```
|
||||
|
||||
The output should look similar:
|
||||
|
||||
```
|
||||
```txt
|
||||
digitalcraftsman git@github.com:digitalcraftsman/hugo.git (fetch)
|
||||
digitalcraftsman git@github.com:digitalcraftsman/hugo.git (push)
|
||||
origin https://github.com/gohugoio/hugo (fetch)
|
||||
@@ -220,14 +217,14 @@ You should never develop against the "master" branch. The development team will
|
||||
|
||||
First, you should always pull the latest changes from the master repository:
|
||||
|
||||
```
|
||||
```txt
|
||||
git checkout master
|
||||
git pull
|
||||
```
|
||||
|
||||
Now we can create a new branch for your additions:
|
||||
|
||||
```
|
||||
```txt
|
||||
git checkout -b <BRANCH-NAME>
|
||||
```
|
||||
|
||||
@@ -245,7 +242,7 @@ We have developed a [separate Hugo documentation contribution guide][docscontrib
|
||||
|
||||
While making changes in the codebase it's a good idea to build the binary to test them:
|
||||
|
||||
```
|
||||
```txt
|
||||
mage hugo
|
||||
```
|
||||
|
||||
@@ -253,31 +250,33 @@ This command generates the binary file at the root of the repository.
|
||||
|
||||
If you want to install the binary in `$GOPATH/bin`, run
|
||||
|
||||
```
|
||||
```txt
|
||||
mage install
|
||||
```
|
||||
|
||||
### Test
|
||||
### Test
|
||||
|
||||
Sometimes changes on the codebase can cause unintended side effects. Or they don't work as expected. Most functions have their own test cases. You can find them in files ending with `_test.go`.
|
||||
|
||||
Make sure the commands
|
||||
Make sure the commands
|
||||
|
||||
```
|
||||
```txt
|
||||
mage -v check
|
||||
```
|
||||
|
||||
passes.
|
||||
|
||||
### Formatting
|
||||
The Go code styleguide maybe is opinionated but it ensures that the codebase looks the same, regardless who wrote the code. Go comes with its own formatting tool. Let's apply the styleguide to our additions:
|
||||
### Formatting
|
||||
|
||||
```
|
||||
The Go code style guide maybe is opinionated but it ensures that the codebase looks the same, regardless who wrote the code. Go comes with its own formatting tool. Let's apply the style guide to our additions:
|
||||
|
||||
```txt
|
||||
mage fmt
|
||||
```
|
||||
|
||||
Once you made your additions commit your changes. Make sure that you follow our [code contribution guidelines](https://github.com/gohugoio/hugo/blob/master/CONTRIBUTING.md):
|
||||
|
||||
```
|
||||
```txt
|
||||
# Add all changed files
|
||||
git add --all
|
||||
git commit --message "YOUR COMMIT MESSAGE"
|
||||
@@ -295,20 +294,20 @@ If you are unsure what a command does leave the commit as it is. We can fix your
|
||||
|
||||
Let's say you want to modify the last commit message. Run the following command and replace the current message:
|
||||
|
||||
```
|
||||
```txt
|
||||
git commit --amend -m"YOUR NEW COMMIT MESSAGE"
|
||||
```
|
||||
|
||||
Take a look at the commit log to see the change:
|
||||
|
||||
```
|
||||
```txt
|
||||
git log
|
||||
# Exit with q
|
||||
```
|
||||
|
||||
After making the last commit you may have forgot something. There is no need to create a new commit. Just add the latest changes and merge them into the intended commit:
|
||||
After making the last commit you may have forgotten something. There is no need to create a new commit. Just add the latest changes and merge them into the intended commit:
|
||||
|
||||
```
|
||||
```txt
|
||||
git add --all
|
||||
git commit --amend
|
||||
```
|
||||
@@ -321,13 +320,13 @@ Modifications such as those described in this section can have serious unintende
|
||||
|
||||
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.
|
||||
|
||||
```
|
||||
```txt
|
||||
git rebase --interactive @~6
|
||||
```
|
||||
|
||||
The `6` at the end of the command represents the number of commits that should be modified. An editor should open and present a list of last six commit messages:
|
||||
|
||||
```
|
||||
```txt
|
||||
pick 80d02a1 tpl: Add hasPrefix to the template funcs' "smoke test"
|
||||
pick aaee038 tpl: Sort the smoke tests
|
||||
pick f0dbf2c tpl: Add the other test case for hasPrefix
|
||||
@@ -340,7 +339,7 @@ In the case above we should merge the last two commits in the commit of this tut
|
||||
|
||||
All operations are written before the commit message. Replace "pick" with an operation. In this case `squash` or `s` for short:
|
||||
|
||||
```
|
||||
```txt
|
||||
pick 80d02a1 tpl: Add hasPrefix to the template funcs' "smoke test"
|
||||
pick aaee038 tpl: Sort the smoke tests
|
||||
pick f0dbf2c tpl: Add the other test case for hasPrefix
|
||||
@@ -353,7 +352,7 @@ We also want to rewrite the commits message of the third last commit. We forgot
|
||||
|
||||
You should end up with a similar setup:
|
||||
|
||||
```
|
||||
```txt
|
||||
pick 80d02a1 tpl: Add hasPrefix to the template funcs' "smoke test"
|
||||
pick aaee038 tpl: Sort the smoke tests
|
||||
pick f0dbf2c tpl: Add the other test case for hasPrefix
|
||||
@@ -366,7 +365,7 @@ Close the editor. It should open again with a new tab. A text is instructing you
|
||||
|
||||
A last time a new tab opens. Enter a new commit message and save again. Your terminal should contain a status message. Hopefully this one:
|
||||
|
||||
```
|
||||
```txt
|
||||
Successfully rebased and updated refs/heads/<BRANCHNAME>.
|
||||
```
|
||||
|
||||
@@ -374,9 +373,9 @@ Check the commit log if everything looks as expected. Should an error occur you
|
||||
|
||||
### Push commits
|
||||
|
||||
To push our commits to the fork on GitHub we need to specify a destination. A destination is defined by the remote and a branch name. Earlier, the defined that the remote url of our fork is the same as our GitHub handle, in my case `digitalcraftsman`. The branch should have the same as our local one. This makes it easy to identify corresponding branches.
|
||||
To push our commits to the fork on GitHub we need to specify a destination. A destination is defined by the remote and a branch name. Earlier, the defined that the remote URL of our fork is the same as our GitHub handle, in my case `digitalcraftsman`. The branch should have the same as our local one. This makes it easy to identify corresponding branches.
|
||||
|
||||
```
|
||||
```txt
|
||||
git push --set-upstream <YOUR-GITHUB-USERNAME> <BRANCHNAME>
|
||||
```
|
||||
|
||||
@@ -402,7 +401,7 @@ Last but not least you should accept the contributor license agreement (CLA). A
|
||||
|
||||
### Automatic builds
|
||||
|
||||
We use a GitHub Actions workflow to build and test. This is a matrix build across combinations of operating system (masOS, Windows, and Ubuntu) and Go versions. The workflow is triggered by the submission of a pull request. If you are a first-time contributor, the workflow requires approval from a project maintainer.
|
||||
We use a GitHub Actions workflow to build and test. This is a matrix build across combinations of operating system (macOS, Windows, and Ubuntu) and Go versions. The workflow is triggered by the submission of a pull request. If you are a first-time contributor, the workflow requires approval from a project maintainer.
|
||||
|
||||
## Where to start?
|
||||
|
||||
@@ -417,18 +416,17 @@ Feel free to [open an issue][newissue] if you think you found a bug or you have
|
||||
* [The Git Book][gitbook] (Free)
|
||||
* [Go Bootcamp][gobootcamp]
|
||||
|
||||
|
||||
[codecademy]: https://www.codecademy.com/learn/learn-git
|
||||
[contributors]: https://github.com/gohugoio/hugo/graphs/contributors
|
||||
[docscontrib]: /contribute/documentation/
|
||||
[forums]: https://discourse.gohugo.io
|
||||
[gitbook]: https://git-scm.com/
|
||||
[gobootcamp]: https://www.golangbootcamp.com/book/get_setup
|
||||
[godl]: https://golang.org/dl/
|
||||
[goinstall]: https://golang.org/doc/install
|
||||
[godl]: https://go.dev/dl/
|
||||
[goinstall]: https://go.dev/doc/install
|
||||
[gvm]: https://github.com/moovweb/gvm
|
||||
[issues]: https://github.com/gohugoio/hugo/issues
|
||||
[newissue]: https://github.com/gohugoio/hugo/issues/new
|
||||
[releases]: /getting-started/
|
||||
[setupgopath]: https://golang.org/doc/code.html#Workspaces
|
||||
[setupgopath]: https://go.dev/doc/code#Workspaces
|
||||
[trygit]: https://try.github.io/levels/1/challenges/1
|
||||
|
||||
@@ -4,7 +4,6 @@ linktitle: Documentation
|
||||
description: Documentation is an integral part of any open source project. The Hugo docs are as much a work in progress as the source it attempts to cover.
|
||||
date: 2017-02-01
|
||||
publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
categories: [contribute]
|
||||
keywords: [docs,documentation,community, contribute]
|
||||
menu:
|
||||
@@ -13,7 +12,6 @@ menu:
|
||||
weight: 20
|
||||
weight: 20
|
||||
sections_weight: 20
|
||||
draft: false
|
||||
aliases: [/contribute/docs/]
|
||||
toc: true
|
||||
---
|
||||
@@ -24,7 +22,7 @@ It's best to make changes to the Hugo docs on your local machine to check for co
|
||||
|
||||
You can then create a separate branch for your additions. Be sure to choose a descriptive branch name that best fits the type of content. The following is an example of a branch name you might use for adding a new website to the showcase:
|
||||
|
||||
```
|
||||
```txt
|
||||
git checkout -b jon-doe-showcase-addition
|
||||
```
|
||||
|
||||
@@ -34,15 +32,15 @@ The Hugo docs make heavy use of Hugo's [archetypes][] feature. All content secti
|
||||
|
||||
Adding new content to the Hugo docs follows the same pattern, regardless of the content section:
|
||||
|
||||
```
|
||||
```txt
|
||||
hugo new <DOCS-SECTION>/<new-content-lowercase>.md
|
||||
```
|
||||
|
||||
### Add a New Function
|
||||
|
||||
Once you have cloned the Hugo repository, you can create a new function via the following command. Keep the file name lowercase.
|
||||
Once you have cloned the Hugo repository, you can create a new function via the following command. Keep the filename lowercase.
|
||||
|
||||
```
|
||||
```txt
|
||||
hugo new functions/newfunction.md
|
||||
```
|
||||
|
||||
@@ -94,13 +92,13 @@ Code blocks are crucial for providing examples of Hugo's new features to end use
|
||||
|
||||
### Standard Syntax
|
||||
|
||||
Across many pages on the Hugo docs, the typical triple-back-tick markdown syntax (```` ``` ````) is used. If you do not want to take the extra time to implement the following code block shortcodes, please use standard GitHub-flavored markdown. The Hugo docs use a version of [highlight.js](https://highlightjs.org/) with a specific set of languages.
|
||||
Across many pages on the Hugo docs, the typical triple-back-tick Markdown syntax (```` ``` ````) is used. If you do not want to take the extra time to implement the following code block shortcodes, please use standard GitHub-flavored Markdown.
|
||||
|
||||
Your options for languages are `xml`/`html`, `go`/`golang`, `md`/`markdown`/`mkd`, `handlebars`, `apache`, `toml`, `yaml`, `json`, `css`, `asciidoc`, `ruby`, `powershell`/`ps`, `scss`, `sh`/`zsh`/`bash`/`git`, `http`/`https`, and `javascript`/`js`.
|
||||
|
||||
````
|
||||
```
|
||||
<h1>Hello world!</h1>
|
||||
````txt
|
||||
```go-html-template
|
||||
{{ range site.RegularPages }}
|
||||
<h2><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></h2>
|
||||
{{ end }}
|
||||
```
|
||||
````
|
||||
|
||||
@@ -117,7 +115,7 @@ With the `code` shortcodes, *you must include triple back ticks and a language d
|
||||
|
||||
`code` is the Hugo docs shortcode you'll use most often. `code` requires has only one named parameter: `file`. Here is the pattern:
|
||||
|
||||
```
|
||||
```go-html-template
|
||||
{{%/* code file="smart/file/name/with/path.html" download="download.html" copy="true" */%}}
|
||||
A whole bunch of coding going on up in here!
|
||||
{{%/* /code */%}}
|
||||
@@ -125,7 +123,6 @@ A whole bunch of coding going on up in here!
|
||||
|
||||
The following are the arguments passed into `code`:
|
||||
|
||||
|
||||
***`file`***
|
||||
: the only *required* argument. `file` is needed for styling but also plays an important role in helping users create a mental model around Hugo's directory structure. Visually, this will be displayed as text in the top left of the code block.
|
||||
|
||||
@@ -142,7 +139,7 @@ This example HTML code block tells Hugo users the following:
|
||||
1. This file *could* live in `layouts/_default`, as demonstrated by `layouts/_default/single.html` as the value for `file`.
|
||||
2. This snippet is complete enough to be downloaded and implemented in a Hugo project, as demonstrated by `download="single.html"`.
|
||||
|
||||
```
|
||||
```go-html-template
|
||||
{{</* code file="layouts/_default/single.html" download="single.html" */>}}
|
||||
{{ define "main" }}
|
||||
<main>
|
||||
@@ -210,7 +207,7 @@ The preceding `output` example will render as follows to the Hugo docs:
|
||||
|
||||
Blockquotes can be added to the Hugo documentation using [typical Markdown blockquote syntax][bqsyntax]:
|
||||
|
||||
```
|
||||
```md
|
||||
> Without the threat of punishment, there is no joy in flight.
|
||||
```
|
||||
|
||||
@@ -220,7 +217,7 @@ The preceding blockquote will render as follows in the Hugo docs:
|
||||
|
||||
However, you can add a quick and easy `<cite>` element (added on the client via JavaScript) by separating your main blockquote and the citation with a hyphen with a single space on each side:
|
||||
|
||||
```
|
||||
```md
|
||||
> Without the threat of punishment, there is no joy in flight. - [Kobo Abe](https://en.wikipedia.org/wiki/Kobo_Abe)
|
||||
```
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ linktitle: Themes
|
||||
description: If you've built a Hugo theme and want to contribute back to the Hugo Community, share it with us.
|
||||
date: 2017-02-01
|
||||
publishdate: 2017-02-01
|
||||
lastmod: 2017-02-27
|
||||
categories: [contribute]
|
||||
keywords: [contribute,themes,design]
|
||||
authors: [digitalcraftsman]
|
||||
@@ -14,7 +13,6 @@ menu:
|
||||
weight: 30
|
||||
weight: 30
|
||||
sections_weight: 30
|
||||
draft: false
|
||||
aliases: [/contribute/theme/]
|
||||
wip: true
|
||||
toc: true
|
||||
|
||||
@@ -46,7 +46,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 lookup 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 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:
|
||||
|
||||
```go-html-template
|
||||
{{ with .Site.GetPage "/blog/my-post" }}{{ .Title }}{{ end }}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user