Merge commit '14e369b961943a0b977776899e24e8bea63834df'

This commit is contained in:
Bjørn Erik Pedersen 2020-03-09 20:21:17 +01:00
commit 6b61f2a5bb
No known key found for this signature in database
GPG key ID: 330E6E2BD4859D8F
32 changed files with 186 additions and 19 deletions

View file

@ -0,0 +1,94 @@
---
title: 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"]
menu:
docs:
parent: "content-management"
weight: 31
weight: 31 #rem
draft: false
aliases: [/content/build-options/]
toc: true
---
They are stored in a reserved Front Matter object named `_build` with the following defaults:
```yaml
_build:
render: true
list: true
publishResources: true
```
#### render
If true, the page will be treated as a published page, holding its dedicated output files (`index.html`, etc...) and permalink.
#### list
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.
Setting this to false will still publish Resources on demand (when a resource's `.Permalink` or `.RelPermalink` is invoked from the templates) but will skip the others.
{{% note %}}
Any page, regardless of their build options, will always be available using the [`.GetPage`]({{< relref "functions/GetPage" >}}) methods.
{{% /note %}}
------
### 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
# content/who-we-are.md`
title: Who we are
_build:
list: false
render: false
```
```go-html-template
{{/* layouts/index.html */}}
<section id="who-we-are">
{{ with site.GetPage "who-we-are" }}
{{ .Content }}
{{ end }}
</section>
```
#### Listing pages without publishing them
Website needs to showcase a few of the hundred "testimonials" available as content files without publishing any of them.
To avoid setting the build options on every testimonials, one can use [`cascade`]({{< relref "/content-management/front-matter#front-matter-cascade" >}}) on the testimonial section's content file.
```yaml
#content/testimonials/_index.md
title: Testimonials
# section build options:
_build:
render: true
# children build options with cascade
cascade:
_build:
render: false
list: true # default
```
```go-html-template
{{/* layouts/_defaults/testimonials.html */}}
<section id="testimonials">
{{ range first 5 .Pages }}
<blockquote cite="{{ .Params.cite }}">
{{ .Content }}
</blockquote>
{{ end }}
</section>

View file

@ -101,6 +101,17 @@ TAG: {{ $k }}: {{ $v }}
{{ end }}
```
Or individually access EXIF data with dot access, e.g.:
```go-html-template
{{ with $img.Exif }}
Date: {{ .Date }}
Lat/Long: {{ .Lat }}/{{ .Long }}
Aperture: {{ .Tags.ApertureValue }}
Focal Length: {{ .Tags.FocalLength }}
{{ end }}
```
#### Exif fields
Date

View file

@ -59,7 +59,7 @@ You can pass multiple lines as parameters to a shortcode by using raw string lit
```
{{</* myshortcode `This is some <b>HTML</b>,
and a new line with a "quouted string".` */>}}
and a new line with a "quoted string".` */>}}
```
### Shortcodes with Markdown

View file

@ -151,7 +151,7 @@ go install
```
Hugo relies on [mage](github.com/magefile/mage) for some convenient build and test targets. If you don't already have it, get it:
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:
```
go get github.com/magefile/mage

View file

@ -134,7 +134,7 @@ PlainText
Here is a code example for how the render-link.html template could look:
{{< code file="layouts/_default/_markup/render-link.html" >}}
<a href="{{ .Destination | safeURL }}"{{ with .Title}} title="{{ . }}"{{ end }}{{ if strings.HasPrefix .Destination "http" }} target="_blank"{{ end }}>{{ .Text }}</a>
<a href="{{ .Destination | safeURL }}"{{ with .Title}} title="{{ . }}"{{ end }}{{ if strings.HasPrefix .Destination "http" }} target="_blank"{{ end }}>{{ .Text | safeHTML }}</a>
{{< /code >}}
#### Image Markdown example:

View file

@ -138,7 +138,7 @@ enableEmoji (false)
enableGitInfo (false)
: Enable `.GitInfo` object for each page (if the Hugo site is versioned by Git). This will then update the `Lastmod` parameter for each page using the last git commit date for that content file.
enableInlineShortcodes
enableInlineShortcodes (false)
: Enable inline shortcode support. See [Inline Shortcodes](/templates/shortcode-templates/#inline-shortcodes).
enableMissingTranslationPlaceholders (false)

View file

@ -124,7 +124,7 @@ Also see the [CLI Doc](/commands/hugo_mod_clean/).
Run `hugo mod clean` to delete the entire modules cache.
Note that you can also configure the `modules` cache with a `maxAge`, see [File Caches](/configuration/#configure-file-caches).
Note that you can also configure the `modules` cache with a `maxAge`, see [File Caches](/hugo-modules/configuration/#configure-file-caches).

View file

@ -22,4 +22,6 @@ Any resource of the aforementioned types can be minifed using `resources.Minify`
```go-html-template
{{ $css := resources.Get "css/main.css" }}
{{ $style := $css | resources.Minify }}
```
```
Note that you can also minify the final HTML output to `/public` by running `hugo --minify`.

Binary file not shown.

After

Width:  |  Height:  |  Size: 113 KiB

View file

@ -1,12 +1,12 @@
---
date: 2020-02-20
title: "0.65.0"
description: "0.65.0"
title: "0.65.0: Hugo Reloaded!"
description: "Draft, expire, resource bundling, and fine grained publishing control for any page. And it's faster."
categories: ["Releases"]
---
**Hugo 0.65** generalizes how a page is packaged and published to be applicable to **any page**. This should solve some of the most common issues we see people ask and talk about on the [issue tracker](https://github.com/gohugoio/hugo/issues) and on the [forum](https://discourse.gohugo.io/).
**Hugo 0.65** generalizes how a page is packaged and published to be applicable to **any page**. This should solve some of the most common issues we see people ask and talk about on the [issue tracker](https://github.com/gohugoio/hugo/issues) and on the [forum](https://discourse.gohugo.io/).
## Release Highlights
@ -39,6 +39,16 @@ Note that all front matter keywords can be set in the [cascade](https://gohugo.i
We have also upgraded to the latest LibSass (v3.6.3). Nothing remarkable functional new here, but it makes Hugo ready for the upcoming [Dart Backport](https://github.com/sass/libsass/pull/2918).
And finally, we have added a `GetTerms` method on `Page`, making listing the terms defined on this page in the given taxonomy much simpler:
```go-html-template
<ul>
{{ range (.GetTerms "tags") }}
<li><a href="{{ .Permalink }}">{{ .LinkTitle }}</a></li>
{{ end }}
</ul>
```
### New in Hugo Modules
There are several improvements to the tooling used in [Hugo Modules](https://gohugo.io/hugo-modules/). One bug fix, but also some improvements to make it easier to manage:

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

View file

@ -1,19 +1,19 @@
---
date: 2020-03-03
title: "0.66.0"
description: "0.66.0"
title: "Hugo 0.66.0: PostCSS Edition"
description: "Native inline, recursive import support in PostCSS/Tailwind, \"dependency-less\" builds, and more …"
categories: ["Releases"]
---
This relase adds [inline `@import`](http://localhost:1313/hugo-pipes/postcss/#options) support to `resources.PostCSS`, with imports relative to Hugo's virtual, composable file system. Another useful addition is the new `build` [configuration section](http://localhost:1313/getting-started/configuration/#configure-build). As an example in `config.toml`:
This release adds [inline `@import`](/hugo-pipes/postcss/#options) support to `resources.PostCSS`, with imports relative to Hugo's virtual, composable file system. Another useful addition is the new `build` [configuration section](/getting-started/configuration/#configure-build). As an example in `config.toml`:
```toml
[build]
useResourceCacheWhen = "always"
```
The above will tell Hugo to _always_ used the cached build resources inside `resources/_gen` for the build steps requiring a non-standard dependency (PostCSS and SCSS/SASS). Valid values are `never`, `always` and `fallback` (default).
The above will tell Hugo to _always_ use the cached build resources inside `resources/_gen` for the build steps requiring a non-standard dependency (PostCSS and SCSS/SASS). Valid values are `never`, `always` and `fallback` (default).
This release represents **27 contributions by 8 contributors** to the main Hugo code base.[@bep](https://github.com/bep) leads the Hugo development with a significant amount of contributions, but also a big shoutout to [@anthonyfok](https://github.com/anthonyfok), [@carlmjohnson](https://github.com/carlmjohnson), and [@sams96](https://github.com/sams96) for their ongoing contributions.

View file

@ -0,0 +1,9 @@
[**Aether**](https://getaether.net) is an open-source peer-to-peer network that hosts self-moderating online-communities.
[**Aether Pro**](https://aether.app), based on Aether, is a collaboration tool for remote-friendly companies.
The site is built by:
* [Burak Nehbit](https://twitter.com/nehbit)

Binary file not shown.

After

Width:  |  Height:  |  Size: 269 KiB

View file

@ -0,0 +1,39 @@
---
title: Aether
date: 2020-02-26
description: "Showcase: \"Hugo is not just a static site generator for us, it's the core framework at the heart of our entire web front-end.\""
# The URL to the site on the internet.
siteURL: https://getaether.net
# Add credit to the article author. Leave blank or remove if not needed/wanted.
byline: "[Burak Nehbit](https://twitter.com/nehbit), Maintainer, Aether"
---
To say that this website, our main online presence, needed to do a lot would be an understatement.
Our site is home to both *Aether* and *Aether Pro*, our **knowledgebase for each product**, a **server for static assets that we use in our emails**, the **interactive sign-up flows**, **payments client**, **downloads provider**, and even a **mechanism for delivering auto-update notifications** to our native clients. We are using a single Hugo site for all these — it's not a static site generator for us, it's the core framework at the heart of our *entire* web front-end.
Not only that, this had to work with one developer crunched for time who spends most of his time working on two separate apps across 3 desktop platforms — someone whose main job is very far from building static websites. We only had scraps of time to design and build this Hugo site, make it performant and scalable, and Hugo did a phenomenal job delivering on that promise.
The last piece is, funnily enough, moving our blog to Hugo, which it is not as of now. This was an inherited mistake we are currently rectifying. Soon, our entire web footprint will be living in Hugo.
### Structure
Our website is built in such a way that there is a separate Vue.js instance for each of the contexts since we are no using JS-based single-page navigation. We use Hugo for navigation and to build most pages. For the pages we need to make interactive, we use Vue.js to build individual, self-contained single-page Javascript apps. One such example is our sign-up flow at [aether.app](https://aether.app), an individual Vue app living within a Hugo page, with its own JS-based navigation.
This is a relatively complex setup, and somewhat out of the ordinary. Yet, even with this custom setup, using Hugo was painless.
### Tools
**CMS**: Hugo
**Theme**: Custom-designed
**Hosting**: Netlify, pushed to production via `git push`.
**Javascript runtime**: Vue.js

View file

@ -184,7 +184,7 @@ images = ["post-cover.png"]
{{</ code-toggle >}}
If `images` aren't specified in the page front-matter, then hugo searches for [image page resources](/content-management/image-processing/) with `feature`, `cover`, or `thumbnail` in their name.
If no image resources with those names are found, the images defined in the [site config](getting-started/configuration/) are used instead.
If no image resources with those names are found, the images defined in the [site config](/getting-started/configuration/) are used instead.
If no images are found at all, then an image-less Twitter `summary` card is used instead of `summary_large_image`.
Hugo uses the page title and description for the card's title and description fields. The page summary is used if no description is given.

View file

@ -239,7 +239,7 @@ Hugo will look for the name given, so you can name it whatever you want. But if
[partial name].[OutputFormat].[suffix]
```
The partial below is a plain text template (Outpuf Format is `CSV`, and since this is the only output format with the suffix `csv`, we don't need to include the Output Format's `Name`):
The partial below is a plain text template (Output Format is `CSV`, and since this is the only output format with the suffix `csv`, we don't need to include the Output Format's `Name`):
```
{{ partial "mytextpartial.csv" . }}

View file

@ -49,10 +49,12 @@ Alternatively, you can use the new [Jekyll import command](/commands/hugo_import
- [wordpress-to-hugo-exporter](https://github.com/SchumacherFM/wordpress-to-hugo-exporter) - A one-click WordPress plugin that converts all posts, pages, taxonomies, metadata, and settings to Markdown and YAML which can be dropped into Hugo. (Note: If you have trouble using this plugin, you can [export your site for Jekyll](https://wordpress.org/plugins/jekyll-exporter/) and use Hugo's built in Jekyll converter listed above.)
- [exitwp-for-hugo](https://github.com/wooni005/exitwp-for-hugo) - A python script which works with the xml export from Wordpress and converts Wordpress pages and posts to Markdown and YAML for hugo.
- [blog2md](https://github.com/palaniraja/blog2md) - Works with [exported xml](https://en.support.wordpress.com/export/) file of your free YOUR-TLD.wordpress.com website. It also saves approved comments to `YOUR-POST-NAME-comments.md` file along with posts.
- [wordhugopress](https://github.com/nantipov/wordhugopress) - A small utility written in Java, exports the entire WordPress site from the database and resource (e.g. images) files stored locally or remotelly. Therefore, migration from the backup files is possible. Supports merging of the multiple WordPress sites into a single Hugo one.
## Medium
- [medium2md](https://github.com/gautamdhameja/medium-2-md) - A simple Medium to Hugo exporter able to import stories in one command, including Front Matter.
- [medium-to-hugo](https://github.com/bgadrian/medium-to-hugo) - CLI tool written in Go to export medium posts into a Hugo compatible Markdown format. Tags and images are included. All images will be downloaded locally and linked appropriately.
## Tumblr

View file

@ -3,7 +3,7 @@ publish = "public"
command = "hugo --gc --minify"
[context.production.environment]
HUGO_VERSION = "0.64.1"
HUGO_VERSION = "0.66.0"
HUGO_ENV = "production"
HUGO_ENABLEGITINFO = "true"
@ -11,20 +11,20 @@ HUGO_ENABLEGITINFO = "true"
command = "hugo --gc --minify --enableGitInfo"
[context.split1.environment]
HUGO_VERSION = "0.64.1"
HUGO_VERSION = "0.66.0"
HUGO_ENV = "production"
[context.deploy-preview]
command = "hugo --gc --minify --buildFuture -b $DEPLOY_PRIME_URL"
[context.deploy-preview.environment]
HUGO_VERSION = "0.64.1"
HUGO_VERSION = "0.66.0"
[context.branch-deploy]
command = "hugo --gc --minify -b $DEPLOY_PRIME_URL"
[context.branch-deploy.environment]
HUGO_VERSION = "0.64.1"
HUGO_VERSION = "0.66.0"
[context.next.environment]
HUGO_ENABLEGITINFO = "true"

Binary file not shown.

After

Width:  |  Height:  |  Size: 145 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB