summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2018-02-27 09:36:36 +0100
committerBjørn Erik Pedersen <[email protected]>2018-02-27 09:36:36 +0100
commit900b5f6cfe5a377ef369d26cd700201be4cf6b06 (patch)
tree4147197c42ef031abac03f61cb36ed93d13fcc80
parent374d184e6747678364fd61f5faf328ec9205eb6b (diff)
downloadhugo-900b5f6cfe5a377ef369d26cd700201be4cf6b06.tar.gz
hugo-900b5f6cfe5a377ef369d26cd700201be4cf6b06.zip
Squashed 'docs/' changes from 1dc05a16b..715741f73
715741f73 Add Netlify config for a split testin branch 4917f0636 Mention that math add/sub/mul/div functions can do float math too 31632beeb Document .Site.Params.mainSections 3416ba80d Update sectionvars.md 295ccb463 Update sections.md 15b5a0342 Fix duplicated paragraph eb13db670 Fix text highlight fa46cafdf Get 1password-support ready 979bb5698 Add 1password support showcase ceb94d1e1 Fix readDir function links git-subtree-dir: docs git-subtree-split: 715741f7393cec2a9b34254bda6e815e9391a632
-rw-r--r--content/content-management/front-matter.md2
-rw-r--r--content/content-management/sections.md2
-rw-r--r--content/content-management/urls.md2
-rw-r--r--content/functions/math.md27
-rw-r--r--content/functions/where.md17
-rw-r--r--content/readfiles/sectionvars.md14
-rw-r--r--content/showcase/1password-support/bio.md5
-rw-r--r--content/showcase/1password-support/featured.pngbin0 -> 165718 bytes
-rw-r--r--content/showcase/1password-support/index.md39
-rw-r--r--content/showcase/1password/bio.md4
-rw-r--r--content/showcase/1password/featured.pngbin87218 -> 0 bytes
-rw-r--r--content/showcase/1password/index.md15
-rw-r--r--content/templates/files.md9
-rw-r--r--netlify.toml8
-rw-r--r--resources/_gen/images/showcase/1password-support/featured_hu870838c23243880857c2e418dd7ac099_165718_1024x512_fill_catmullrom_top.pngbin0 -> 290059 bytes
-rw-r--r--resources/_gen/images/showcase/1password-support/featured_hu870838c23243880857c2e418dd7ac099_165718_640x0_resize_catmullrom.pngbin0 -> 107351 bytes
-rw-r--r--resources/_gen/images/showcase/1password-support/featured_hu870838c23243880857c2e418dd7ac099_165718_8b32e959be6137399a224ecc56caffb1.pngbin0 -> 72430 bytes
-rw-r--r--resources/_gen/images/showcase/1password/featured_hu6362523fb09abcc0ff53ad78917489db_87218_1024x512_fill_catmullrom_top.pngbin154132 -> 0 bytes
-rw-r--r--resources/_gen/images/showcase/1password/featured_hu6362523fb09abcc0ff53ad78917489db_87218_640x0_resize_catmullrom.pngbin67349 -> 0 bytes
-rw-r--r--resources/_gen/images/showcase/1password/featured_hu6362523fb09abcc0ff53ad78917489db_87218_de2d346406f05cc9747f62253550350f.pngbin48792 -> 0 bytes
-rw-r--r--resources/_gen/images/showcase/stackimpact/featured_hu863cdba7b6e18bb95f64289a25912f5c_153794_1024x512_fill_catmullrom_top.pngbin0 -> 187835 bytes
-rw-r--r--resources/_gen/images/showcase/stackimpact/featured_hu863cdba7b6e18bb95f64289a25912f5c_153794_5f4044a9cb8ece7d6e61bd0e0fb32a0d.pngbin0 -> 63795 bytes
-rw-r--r--resources/_gen/images/showcase/stackimpact/featured_hu863cdba7b6e18bb95f64289a25912f5c_153794_640x0_resize_catmullrom.pngbin0 -> 91851 bytes
23 files changed, 99 insertions, 45 deletions
diff --git a/content/content-management/front-matter.md b/content/content-management/front-matter.md
index 01afb2e60..a6a3f2403 100644
--- a/content/content-management/front-matter.md
+++ b/content/content-management/front-matter.md
@@ -167,8 +167,6 @@ include_toc: true
show_comments: false
```
-These two user-defined fields can then be accessed via `.Params.include_toc` and `.Params.show_comments`, respectively. The [Variables][variables] section provides more information on using Hugo's page- and site-level variables in your templates.
-
## Order Content Through Front Matter
diff --git a/content/content-management/sections.md b/content/content-management/sections.md
index def5cac87..0e167d143 100644
--- a/content/content-management/sections.md
+++ b/content/content-management/sections.md
@@ -38,7 +38,7 @@ blog
{{% note %}}
When we talk about a **section** in correlation with template selection, it is currently always the root section only (`/blog/funny/mypost/ => blog`).
-It is currently not possible to add a specific layout for one of the sub-sections.
+If you need a specific template for a sub-section, you need to adjust either the `type` or `layout` in front matter.
{{% /note %}}
diff --git a/content/content-management/urls.md b/content/content-management/urls.md
index 54ce81ee0..dd91fbced 100644
--- a/content/content-management/urls.md
+++ b/content/content-management/urls.md
@@ -146,7 +146,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:`
+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:
```
<!DOCTYPE html>
diff --git a/content/functions/math.md b/content/functions/math.md
index 2ef7a5d23..eb38fdd0b 100644
--- a/content/functions/math.md
+++ b/content/functions/math.md
@@ -20,14 +20,19 @@ draft: false
aliases: []
---
-| Function | Description | Example |
-|----------------|-------------------------------------------------------------------------------|----------------------------------|
-| `add` | Adds two integers. | `{{add 1 2}}` &rarr; 3 |
-| `div` | Divides two integers. | `{{div 6 3}}` &rarr; 2 |
-| `mod` | Modulus of two integers. | `{{mod 15 3}}` &rarr; 0 |
-| `modBool` | Boolean of modulus of two integers. Evaluates to `true` if result equals 0. | `{{modBool 15 3}}` &rarr; true |
-| `mul` | Multiplies two integers. | `{{mul 2 3}}` &rarr; 6 |
-| `sub` | Subtracts two integers. | `{{sub 3 2}}` &rarr; 1 |
-| `math.Ceil` | Returns the least integer value greater than or equal to the given number. | `{{math.Ceil 2.1}}` &rarr; 3 |
-| `math.Floor` | Returns the greatest integer value less than or equal to the given number. | `{{math.Floor 1.9}}` &rarr; 1 |
-| `math.Round` | Returns the nearest integer, rounding half away from zero. | `{{math.Round 1.5}}` &rarr; 2 |
+| Function | Description | Example |
+|--------------|-----------------------------------------------------------------------------|----------------------------------|
+| `add` | Adds two numbers. | `{{add 1 2}}` &rarr; `3` |
+| | *If one of the numbers is a float, the result is a float.* | `{{add 1.1 2}}` &rarr; `3.1` |
+| `sub` | Subtracts two numbers. | `{{sub 3 2}}` &rarr; `1` |
+| | *If one of the numbers is a float, the result is a float.* | `{{sub 3 2.5}}` &rarr; `0.5` |
+| `mul` | Multiplies two numbers. | `{{mul 2 3}}` &rarr; `6` |
+| | *If one of the numbers is a float, the result is a float.* | `{{mul 2 3.1}}` &rarr; `6.2` |
+| `div` | Divides two numbers. | `{{div 6 3}}` &rarr; `2` |
+| | | `{{div 6 4}}` &rarr; `1` |
+| | *If one of the numbers is a float, the result is a float.* | `{{div 6 4.0}}` &rarr; `1.5` |
+| `mod` | Modulus of two integers. | `{{mod 15 3}}` &rarr; `0` |
+| `modBool` | Boolean of modulus of two integers. Evaluates to `true` if result equals 0. | `{{modBool 15 3}}` &rarr; `true` |
+| `math.Ceil` | Returns the least integer value greater than or equal to the given number. | `{{math.Ceil 2.1}}` &rarr; `3` |
+| `math.Floor` | Returns the greatest integer value less than or equal to the given number. | `{{math.Floor 1.9}}` &rarr; `1` |
+| `math.Round` | Returns the nearest integer, rounding half away from zero. | `{{math.Round 1.5}}` &rarr; `2` |
diff --git a/content/functions/where.md b/content/functions/where.md
index 262fd6ebc..574fef2df 100644
--- a/content/functions/where.md
+++ b/content/functions/where.md
@@ -134,4 +134,21 @@ Only the following operators are available for `nil`
{{ end }}
```
+## Portable `where` filters
+
+This is especially important for themes, but to list the most relevant pages on the front page or similar, you can use `.Site.Params.mainSections` list.
+
+This will, by default, list pages from the _section with the most pages_.
+
+```html
+{{ $pages := where .Site.RegularPages "Type" "in" .Site.Params.mainSections }}
+```
+
+The user can override the default in `config.toml`:
+
+```toml
+[params]
+mainSections = ["blog", "docs"]
+```
+
[intersect]: /functions/intersect/
diff --git a/content/readfiles/sectionvars.md b/content/readfiles/sectionvars.md
index c0756e7d1..1b97a12d6 100644
--- a/content/readfiles/sectionvars.md
+++ b/content/readfiles/sectionvars.md
@@ -1,20 +1,20 @@
.CurrentSection
-: the page's current section. The value can be the page itself if it is a section or the homepage.
+: The page's current section. The value can be the page itself if it is a section or the homepage.
.InSection $anotherPage
-: whether the given page is in the current section. Note that this will always return false for pages that are not either regular, home or section pages.
+: Whether the given page is in the current section. Note that this will always return false for pages that are not either regular, home or section pages.
.IsAncestor $anotherPage
-: whether the current page is an ancestor of the given page. Note that this method is not relevant for taxonomy lists and taxonomy terms pages.
+: Whether the current page is an ancestor of the given page. Note that this method is not relevant for taxonomy lists and taxonomy terms pages.
.IsDescendant $anotherPage
-: whether the current page is a descendant of the given page. Note that this method is not relevant for taxonomy lists and taxonomy terms pages.
+: Whether the current page is a descendant of the given page. Note that this method is not relevant for taxonomy lists and taxonomy terms pages.
.Parent
-: a section's parent section or a page's section.
+: A section's parent section or a page's section.
.Section
-: the [section](/content-management/sections/) this content belongs to. **Note:** For nested sections, this is the first path element in the directory, for example, `/blog/funny/mypost/ => blog`.
+: The [section](/content-management/sections/) this content belongs to. **Note:** For nested sections, this is the first path element in the directory, for example, `/blog/funny/mypost/ => blog`.
.Sections
-: the [sections](/content-management/sections/) below this content.
+: The [sections](/content-management/sections/) below this content.
diff --git a/content/showcase/1password-support/bio.md b/content/showcase/1password-support/bio.md
new file mode 100644
index 000000000..9187908d9
--- /dev/null
+++ b/content/showcase/1password-support/bio.md
@@ -0,0 +1,5 @@
+
+**1Password** is a password manager that keeps you safe online. It protects your secure information behind the one password only you know.
+
+
+The [1Password Support](https://support.1password.com/) website was built from scratch with **Hugo** and enhanced with **React** and **Elasticsearch** to give us the best of both worlds: The simplicity and performance of a static site, with the richness of a hosted web app.
diff --git a/content/showcase/1password-support/featured.png b/content/showcase/1password-support/featured.png
new file mode 100644
index 000000000..8e46495e6
--- /dev/null
+++ b/content/showcase/1password-support/featured.png
Binary files differ
diff --git a/content/showcase/1password-support/index.md b/content/showcase/1password-support/index.md
new file mode 100644
index 000000000..55038bc7e
--- /dev/null
+++ b/content/showcase/1password-support/index.md
@@ -0,0 +1,39 @@
+---
+
+title: 1Password Support
+date: 2018-02-22
+description: "Showcase: \"Compiles 400 pages in five languages in the blink of an eye.\""
+siteURL: https://support.1password.com/
+byline: "[Mitch Cohen](https://github.com/mitchchn), Documentation Team Lead"
+aliases: [/showcase/1password/]
+
+---
+
+At 1Password, we used to go through a different documentation platform every month: blog engines, ebooks, wikis, site generators written in Ruby and JavaScript. Each was inadequate in its own special way. Then we found **Hugo**. We made one last switch, and we're glad we did.
+
+### Not all static site generators are created equal
+
+Finding a tool that will make your customers, writers, designers, _and_ DevOps team happy is no easy task, but we managed it with Hugo:
+
+**Hugo is static**. We're a security company, so we swear by static sites and use them wherever possible. We feel much safer pointing customers at HTML files than at a complicated server which needs to be hardened.
+
+**Hugo is Go**. We love the Go programming language at 1Password, and we were delighted to learn that Hugo used the same Go template syntax that our designers and front-end developers had already mastered.
+
+**Hugo is FAST**. Our previous static site generator took nearly a minute to compile our (then much smaller) site. Developers might be used to this, but it wasn't cutting it for writers who wanted to see live previews of their work. Hugo did the same job in milliseconds, and to this day compiles 400 pages in five languages in the blink of an eye.
+
+**Hugo is flexible**. Thanks to Hugo's content and layout system, we were able to preserve our existing file and folder structure and port our entire production site in a few days. We could then create new content types that weren't possible before, like these snazzy [showcases](https://support.1password.com/explore/extension/).
+
+**Hugo is great for writers**. Our documentation team was already comfortable with Markdown and Git and could start creating content for Hugo with zero downtime. Once we added shortcodes, our writers were able to dress up articles with features like [platform boxes](https://support.1password.com/get-the-apps/) with just a bit of new syntax.
+
+**Hugo has an amazing developer community**. Hugo updates are frequent and filled to the brim with features and fixes. As we developed the multilingual version of our site, we submitted PRs for features we needed and were helped through the process by [@bep](https://github.com/bep) and others.
+
+**Hugo is simple to deploy**. Hugo has just the right amount of configuration options to fit into our build system without being too complicated.
+
+### Tech specs
+
+* [1Password Support](https://support.1password.com) uses Hugo with a custom theme. It shares styles and some template code with [1Password.com](https://1password.com), which we also moved to Hugo in 2016.
+* Code and articles live in a private GitHub repository, which is deployed to a static content server using Git hooks.
+* Writers build and preview the site on their computers and contribute content using pull requests.
+ * We use Hugo's [multilingual support](/content-management/multilingual/) to build the site in English, Spanish, French, Italian, German, and Russian. With the help of Hugo, 1Password Support became our very first site in multiple languages.
+* Our [contact form](https://support.1password.com/contact) is a single-page React app. We were able to integrate it with Hugo seamlessly thanks to its support for static files.
+* The one part of the support site which is not static is our search engine, which we developed with Elasticsearch and host on AWS.
diff --git a/content/showcase/1password/bio.md b/content/showcase/1password/bio.md
deleted file mode 100644
index 196b0c527..000000000
--- a/content/showcase/1password/bio.md
+++ /dev/null
@@ -1,4 +0,0 @@
-
-**1Password** is a popular password manager.
-
-Their website is built with **Hugo**. \ No newline at end of file
diff --git a/content/showcase/1password/featured.png b/content/showcase/1password/featured.png
deleted file mode 100644
index 32d3c5fd9..000000000
--- a/content/showcase/1password/featured.png
+++ /dev/null
Binary files differ
diff --git a/content/showcase/1password/index.md b/content/showcase/1password/index.md
deleted file mode 100644
index ba4c135f7..000000000
--- a/content/showcase/1password/index.md
+++ /dev/null
@@ -1,15 +0,0 @@
----
-
-title: 1password.com
-
-date: 2018-02-16
-
-description: "Showcase: \"1Password is my favourite piece of boring software, and I was happy to see that they built their website with Hugo\""
-
-siteURL: https://1password.com/
-
-byline: "[bep](https://github.com/bep), Hugo Lead"
-
----
-
-**1Password** is my favourite piece of boring software. It just works. I was pleased to read that they use [Go](https://golang.org/) (aka Golang) extensively to build their software. This is also Hugo's platform. And I was also happy to see that they have **built their website with Hugo**. \ No newline at end of file
diff --git a/content/templates/files.md b/content/templates/files.md
index 7a0f40822..b7fbf66a2 100644
--- a/content/templates/files.md
+++ b/content/templates/files.md
@@ -21,11 +21,11 @@ toc: true
## Traverse Local Files
-With Hugo's [`readDir` and `readFile` template functions][reads], you can traverse your website's files on your server.
+With Hugo's [`readDir`][readDir] and [`readFile`][readFile] template functions, you can traverse your website's files on your server.
## Use `readDir`
-The [`readDir` function][reads] returns an array of [`os.FileInfo`][osfileinfo]. It takes the file's `path` as a single string argument. This path can be to any directory of your website (i.e., as found on your server's file system).
+The [`readDir` function][readDir] returns an array of [`os.FileInfo`][osfileinfo]. It takes the file's `path` as a single string argument. This path can be to any directory of your website (i.e., as found on your server's file system).
Whether the path is absolute or relative does not matter because---at least for `readDir`---the root of your website (typically `./public/`) in effect becomes both:
@@ -56,7 +56,7 @@ The initial slash `/` in `pathURL` is important in the `directoryindex` shortcod
## Use `readFile`
-The [`readfile` function][reads] reads a file from disk and converts it into a string to be manipulated by other Hugo functions or added as-is. `readFile` takes the file, including path, as an argument passed to the function.
+The [`readfile` function][readFile] reads a file from disk and converts it into a string to be manipulated by other Hugo functions or added as-is. `readFile` takes the file, including path, as an argument passed to the function.
To use the `readFile` function in your templates, make sure the path is relative to your *Hugo project's root directory*:
@@ -107,7 +107,8 @@ And here is the result as [called directly in the Hugo docs][] and rendered for
[called directly in the Hugo docs]: https://github.com/gohugoio/hugo/blob/master/docs/content/templates/files.md
[dirindex]: https://github.com/gohugoio/hugo/blob/master/docs/layouts/shortcodes/directoryindex.html
[osfileinfo]: https://golang.org/pkg/os/#FileInfo
-[reads]: /functions/readfile/
+[readDir]: /functions/readdir/
+[readFile]: /functions/readfile/
[sc]: /content-management/shortcodes/
[sct]: /templates/shortcode-templates/
[readfilesource]: https://github.com/gohugoio/hugo/blob/master/
diff --git a/netlify.toml b/netlify.toml
index 9badd7024..6f21789b2 100644
--- a/netlify.toml
+++ b/netlify.toml
@@ -7,6 +7,13 @@ HUGO_VERSION = "0.36.1"
HUGO_ENV = "production"
HUGO_ENABLEGITINFO = "true"
+[context.split1]
+command = "hugo --enableGitInfo"
+
+[context.split1.environment]
+HUGO_VERSION = "0.36.1"
+HUGO_ENV = "production"
+
[context.deploy-preview]
command = "hugo -b $DEPLOY_PRIME_URL"
@@ -21,3 +28,4 @@ HUGO_VERSION = "0.36.1"
[context.next.environment]
HUGO_ENABLEGITINFO = "true"
+
diff --git a/resources/_gen/images/showcase/1password-support/featured_hu870838c23243880857c2e418dd7ac099_165718_1024x512_fill_catmullrom_top.png b/resources/_gen/images/showcase/1password-support/featured_hu870838c23243880857c2e418dd7ac099_165718_1024x512_fill_catmullrom_top.png
new file mode 100644
index 000000000..0dd0e8ef6
--- /dev/null
+++ b/resources/_gen/images/showcase/1password-support/featured_hu870838c23243880857c2e418dd7ac099_165718_1024x512_fill_catmullrom_top.png
Binary files differ
diff --git a/resources/_gen/images/showcase/1password-support/featured_hu870838c23243880857c2e418dd7ac099_165718_640x0_resize_catmullrom.png b/resources/_gen/images/showcase/1password-support/featured_hu870838c23243880857c2e418dd7ac099_165718_640x0_resize_catmullrom.png
new file mode 100644
index 000000000..5f7df90b2
--- /dev/null
+++ b/resources/_gen/images/showcase/1password-support/featured_hu870838c23243880857c2e418dd7ac099_165718_640x0_resize_catmullrom.png
Binary files differ
diff --git a/resources/_gen/images/showcase/1password-support/featured_hu870838c23243880857c2e418dd7ac099_165718_8b32e959be6137399a224ecc56caffb1.png b/resources/_gen/images/showcase/1password-support/featured_hu870838c23243880857c2e418dd7ac099_165718_8b32e959be6137399a224ecc56caffb1.png
new file mode 100644
index 000000000..2221ab06e
--- /dev/null
+++ b/resources/_gen/images/showcase/1password-support/featured_hu870838c23243880857c2e418dd7ac099_165718_8b32e959be6137399a224ecc56caffb1.png
Binary files differ
diff --git a/resources/_gen/images/showcase/1password/featured_hu6362523fb09abcc0ff53ad78917489db_87218_1024x512_fill_catmullrom_top.png b/resources/_gen/images/showcase/1password/featured_hu6362523fb09abcc0ff53ad78917489db_87218_1024x512_fill_catmullrom_top.png
deleted file mode 100644
index 18e58f756..000000000
--- a/resources/_gen/images/showcase/1password/featured_hu6362523fb09abcc0ff53ad78917489db_87218_1024x512_fill_catmullrom_top.png
+++ /dev/null
Binary files differ
diff --git a/resources/_gen/images/showcase/1password/featured_hu6362523fb09abcc0ff53ad78917489db_87218_640x0_resize_catmullrom.png b/resources/_gen/images/showcase/1password/featured_hu6362523fb09abcc0ff53ad78917489db_87218_640x0_resize_catmullrom.png
deleted file mode 100644
index 8a129e5e1..000000000
--- a/resources/_gen/images/showcase/1password/featured_hu6362523fb09abcc0ff53ad78917489db_87218_640x0_resize_catmullrom.png
+++ /dev/null
Binary files differ
diff --git a/resources/_gen/images/showcase/1password/featured_hu6362523fb09abcc0ff53ad78917489db_87218_de2d346406f05cc9747f62253550350f.png b/resources/_gen/images/showcase/1password/featured_hu6362523fb09abcc0ff53ad78917489db_87218_de2d346406f05cc9747f62253550350f.png
deleted file mode 100644
index 27c31cc92..000000000
--- a/resources/_gen/images/showcase/1password/featured_hu6362523fb09abcc0ff53ad78917489db_87218_de2d346406f05cc9747f62253550350f.png
+++ /dev/null
Binary files differ
diff --git a/resources/_gen/images/showcase/stackimpact/featured_hu863cdba7b6e18bb95f64289a25912f5c_153794_1024x512_fill_catmullrom_top.png b/resources/_gen/images/showcase/stackimpact/featured_hu863cdba7b6e18bb95f64289a25912f5c_153794_1024x512_fill_catmullrom_top.png
new file mode 100644
index 000000000..6ff6a912f
--- /dev/null
+++ b/resources/_gen/images/showcase/stackimpact/featured_hu863cdba7b6e18bb95f64289a25912f5c_153794_1024x512_fill_catmullrom_top.png
Binary files differ
diff --git a/resources/_gen/images/showcase/stackimpact/featured_hu863cdba7b6e18bb95f64289a25912f5c_153794_5f4044a9cb8ece7d6e61bd0e0fb32a0d.png b/resources/_gen/images/showcase/stackimpact/featured_hu863cdba7b6e18bb95f64289a25912f5c_153794_5f4044a9cb8ece7d6e61bd0e0fb32a0d.png
new file mode 100644
index 000000000..7e87c0a5a
--- /dev/null
+++ b/resources/_gen/images/showcase/stackimpact/featured_hu863cdba7b6e18bb95f64289a25912f5c_153794_5f4044a9cb8ece7d6e61bd0e0fb32a0d.png
Binary files differ
diff --git a/resources/_gen/images/showcase/stackimpact/featured_hu863cdba7b6e18bb95f64289a25912f5c_153794_640x0_resize_catmullrom.png b/resources/_gen/images/showcase/stackimpact/featured_hu863cdba7b6e18bb95f64289a25912f5c_153794_640x0_resize_catmullrom.png
new file mode 100644
index 000000000..7a0cab5e3
--- /dev/null
+++ b/resources/_gen/images/showcase/stackimpact/featured_hu863cdba7b6e18bb95f64289a25912f5c_153794_640x0_resize_catmullrom.png
Binary files differ