Skip to content

Commit

Permalink
Squashed 'docs/' changes from 2fc775dec..f97826a17
Browse files Browse the repository at this point in the history
f97826a17 Merge commit '12ecbf4a1b05c2794281f47909c836b1a005bc19'
12ecbf4a1 Squashed 'themes/gohugoioTheme/' changes from ecad8247..fe71e360
aaa7ac214 Ignore .DS_Store files
0e023ca12 Remove comments in showcase front matter
f3ba5ac87 Hartwell Insurance showcase
47aefdbda Remove unnecessary duplicated words
612693b4f Some minor language fixes
a833ba15b Spelling
5972e70a9 Revert "showcase: Even smaller file"
3479b975e showcase: Even smaller file
2272e0b83 showcase: Reduce image size
718c3c3e5 Spelling
0b954eccb showcase: Pace copy-edits
baded8064 showcase: Pace
842c1cedf Add a Showcase copyright notice
c5963edaa Update installing
4fa0b0d73 Add link to showcase template
d0f303916 Add some showcase guide content
c809789b1 Add srcset to the showcase screenshots
49d875904 Start of a template
1153de221 Clean resouerces
69f00df4c Remove the showcases
653ad5bcd Add a simple byline
c5342b5e5 Regenerate image after rebase
b80669b34 Bump version in config.toml
cd5c79c67 Fix an issue where whitespace wrap caused scrollbars on some browsers
f00547e98 Add section to the title element
aa10defed Iterating on Showcase (#330)
76a0bfbc3 Add some dummy content to some of the showcase pages
66f68964d Standardize showcase metadata
627ffa6d4 Adjust showcase image size on front page
cbc3efece Redo some showcase images
054b54cb6 Use .RelPermalink and not .URL
82ba5f1c6 Add resources
d1415795b Move showcase items in list view to a template in the layout
f34620e90 Tweak details box for mobile
df6a0bf24 Include images that changed from the column shift
02036581f Improve showcase single layout
5f7730c89 Improve styling of showcase prev/next buttons
a2b2f7731 Remove extra div that was breaking mobile layout of the showcase
b172fe5f4 Add block class to to images on mobile so they behave as expected
a4ebfec86 Add a proper RSS feed to home page
0524479e0 Move showcase images to proper Resources
0544b57df Convert showcase pages to bundles
8febaab2b Add Showcase to Home page and internal pages
26d1f4542 Fix baseURL in Netlify deploy previews
046497616 Revert "Try to fix the Netlify preview baseURL setup"
80dce17ca Revert "Add some temporary baseURL debug"
8617e8692 Add some temporary baseURL debug
371e56bce Try to fix the Netlify preview baseURL setup
1b70b3f18 Add Netlify CMS to Frontends list
d6184e71d Fix menu for "What is Hugo" page
1ae83ad3e Fix mobile menu display so it shows on mid-size displays
f60e1f750 Edited slight typo, added "of"
56b906667 Fix typo
c5bea5cbd Release 0.36
00539094e releaser: Prepare repository for 0.37-DEV
b222cbdf2 releaser: Add release notes to /docs for release of 0.36
e59d1d766 releaser: Bump versions for release of 0.36
9620aa002 docs: Add documentation for smart cropping etc.
91c3801f1 Merge commit 'c305e44f5f081e4436195923a4593e396f07cd49'
8e71ff60b releaser: Prepare repository for 0.36-DEV

git-subtree-dir: docs
git-subtree-split: f97826a17209fe3e153b7f5bbf69c511e4e13203
  • Loading branch information
bep committed Feb 10, 2018
1 parent c305e44 commit 9cc9bab
Show file tree
Hide file tree
Showing 89 changed files with 626 additions and 11,742 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -1,3 +1,4 @@
/.idea
/public
nohup.out
.DS_Store
20 changes: 19 additions & 1 deletion config.toml
Expand Up @@ -71,7 +71,7 @@ twitter = "GoHugoIO"
[params]
description = "The world’s fastest framework for building websites"
## Used for views in rendered HTML (i.e., rather than using the .Hugo variable)
release = "0.35"
release = "0.36"
## Setting this to true will add a "noindex" to *EVERY* page on the site
removefromexternalsearch = false
## Gh repo for site footer (include trailing slash)
Expand Down Expand Up @@ -103,6 +103,18 @@ twitter = "GoHugoIO"
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"

# Defatult JPEG quality setting. Default is 75.
quality = 75

anchor = "smart"


## As of v0.20, all content files include a default "categories" value that's the same as the section. This was a cheap future-proofing method and should/could be changed accordingly.
[taxonomies]
category = "categories"
Expand Down Expand Up @@ -238,6 +250,12 @@ twitter = "GoHugoIO"
identifier = "themes"
url = "https://themes.gohugo.io/"

[[menu.global]]
name = "Showcase"
weight = 20
identifier = "showcase"
url = "/showcase/"

# Anything with a weight > 100 gets an external icon
[[menu.global]]
name = "Community"
Expand Down
2 changes: 1 addition & 1 deletion content/_index.md
@@ -1,5 +1,5 @@
---
title: "A Fast and Flexible Website Generator"
title: "The world’s fastest framework for building websites"
date: 2017-03-02T12:00:00-05:00
features:
- heading: Blistering Speed
Expand Down
2 changes: 1 addition & 1 deletion content/about/what-is-hugo.md
Expand Up @@ -7,7 +7,7 @@ publishdate: 2017-02-01
lastmod: 2017-02-01
layout: single
menu:
main:
docs:
parent: "about"
weight: 10
weight: 10
Expand Down
2 changes: 1 addition & 1 deletion content/content-management/_index.md
Expand Up @@ -17,4 +17,4 @@ aliases: [/content/,/content/organization]
toc: false
---

A static site generator needs to extend beyond front matter and a couple templates to be both scalable and *manageable*. Hugo was designed with not only developers in mind, but also content managers and authors.
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.
56 changes: 55 additions & 1 deletion content/content-management/image-processing/index.md
Expand Up @@ -138,4 +138,58 @@ And it is used like this:

{{% note %}}
**Tip:** Note the self-closing shortcode syntax above. The `imgproc` shortcode can be called both with and without **inner content**.
{{% /note %}}
{{% /note %}}

## Image Processing Config

You can configure an `imaging` section in `config.toml` with default image processing options:

```toml
[imaging]
# Default resample filter used for resizing. Default is Box,
# a simple and fast averaging filter appropriate for downscaling.
# See https://github.com/disintegration/imaging
resampleFilter = "box"

# Defatult JPEG quality setting. Default is 75.
quality = 75

# Anchor used when cropping pictures.
# Default is "smart" which does Smart Cropping, using https://github.com/muesli/smartcrop
# Smart Cropping is content aware and tries to find the best crop for each image.
# Valid values are Smart, Center, TopLeft, Top, TopRight, Left, Right, BottomLeft, Bottom, BottomRight
anchor = "smart"

```

All of the above settings can also be set per image procecssing.

## Smart Cropping of Images

By default, Hugo will use the [Smartcrop](https://github.com/muesli/smartcrop), a library created by [muesli](https://github.com/muesli), when cropping images with `.Fill`. You can set the anchor point manually, but in most cases the smart option will make a good choice. And we will work with the libray author to improve this in the future.

An example using the sunset image from above:


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


## Image Processing Performance Consideration

Processed images are stored below `<project-dir>/resources` (can be set with `resourceDir` config setting). This folder is deliberately placed in the project, as it is recommended to check these into source control as part of the project. These images are not "Hugo fast" to generate, but once generated they can be reused.

If you change your image settings (e.g. size), remove or rename images etc., you will end up with unused images taking up space and cluttering your project.

To clean up, run:

```bash
hugo --gc
```


{{% note %}}
**GC** is short for **Garbage Collection**.
{{% /note %}}



2 changes: 1 addition & 1 deletion content/content-management/organization/index.md
Expand Up @@ -29,7 +29,7 @@ The illustration shows 3 bundles. Note that the home page bundle cannot contain


{{% note %}}
The bundle docuementation is **work in progress**. We will publish more comprehensive docs about this soon.
The bundle documentation is **work in progress**. We will publish more comprehensive docs about this soon.
{{% /note %}}


Expand Down
2 changes: 1 addition & 1 deletion content/content-management/urls.md
Expand Up @@ -161,7 +161,7 @@ Assuming a `baseURL` of `example.com`, the contents of the auto-generated alias
</html>
```

The `http-equiv="refresh"` line is what performs the redirect, in 0 seconds in this case. If an end user of your website goes to `https://example.com/posts/my-old-url`, they will now be automatically redirected to the newer, correct URL. The addition of `<meta name="robots" content="noindex">` lets search engine bots know they they should not crawl and index your new alias page.
The `http-equiv="refresh"` line is what performs the redirect, in 0 seconds in this case. If an end user of your website goes to `https://example.com/posts/my-old-url`, they will now be automatically redirected to the newer, correct URL. The addition of `<meta name="robots" content="noindex">` lets search engine bots know that they should not crawl and index your new alias page.

### Customize
You may customize this alias page by creating an `alias.html` template in the
Expand Down
18 changes: 10 additions & 8 deletions content/getting-started/installing.md
Expand Up @@ -67,22 +67,23 @@ choco install hugo -confirm

* [Git][installgit]
* [Go (latest or previous version)][installgo]
* [govendor][]

#### Vendored Dependencies

Hugo uses [govendor][] to vendor dependencies, but we don't commit the vendored packages themselves to the Hugo git repository. Therefore, a simple `go get` is *not* supported because the command is not vendor aware. *You must use `govendor` to fetch Hugo's dependencies.*
Hugo uses [dep][] to vendor dependencies, but we don't commit the vendored packages themselves to the Hugo git repository. Therefore, a simple `go get` is *not* supported because the command is not vendor aware.

The simplest way is to use [mage][] (a Make alternative for Go projects.)

#### Fetch from GitHub

{{< code file="from-gh.sh" >}}
go get github.com/kardianos/govendor
govendor get github.com/gohugoio/hugo
go install github.com/gohugoio/hugo
go get github.com/magefile/mage
go get -d github.com/gohugoio/hugo
cd $HOME/go/src/github.com/gohugoio/hugo
mage vendor
mage install
{{< /code >}}

`govendor get` will fetch Hugo and all its dependent libraries to `$GOPATH/src/github.com/gohugoio/hugo`, and `go install` compiles everything into a final `hugo` (or `hugo.exe`) executable inside `$GOPATH/bin/`.

{{% note %}}
If you are a Windows user, substitute the `$HOME` environment variable above with `%USERPROFILE%`.
{{% /note %}}
Expand Down Expand Up @@ -486,7 +487,8 @@ Now that you've installed Hugo, read the [Quick Start guide][quickstart] and exp
[content]: /content-management/
[@dhersam]: https://github.com/dhersam
[forum]: https://discourse.gohugo.io
[govendor]: https://github.com/kardianos/govendor
[mage]: https://github.com/magefile/mage
[dep]: https://github.com/golang/dep
[highlight shortcode]: /content-management/shortcodes/#highlight
[installgit]: http://git-scm.com/
[installgo]: https://golang.org/dl/
Expand Down
2 changes: 1 addition & 1 deletion content/hosting-and-deployment/deployment-with-wercker.md
Expand Up @@ -128,7 +128,7 @@ git push -u origin master

## Set Up Wercker

To sign up for a free Wercker account, go to <https://wercker.com> and click the the **Sign Up** button on the top right of the home screen.
To sign up for a free Wercker account, go to <https://wercker.com> and click the **Sign Up** button on the top right of the home screen.

![][3]

Expand Down
2 changes: 1 addition & 1 deletion content/hosting-and-deployment/hosting-on-keycdn.md
Expand Up @@ -24,7 +24,7 @@ draft: false

## Create a KeyCDN Pull Zone

The first step will be to login to your KeyCDN account and create a new zone. Name this whatever you like and select the [Pull Zone](https://www.keycdn.com/support/create-a-pull-zone/) option. As for the the origin URL, your site will be running on [GitLab Pages](https://docs.gitlab.com/ee/user/project/pages/getting_started_part_one.html) with a URL of `https://youruser.gitlab.io/reponame/`. Use this as the Origin URL.
The first step will be to login to your KeyCDN account and create a new zone. Name this whatever you like and select the [Pull Zone](https://www.keycdn.com/support/create-a-pull-zone/) option. As for the origin URL, your site will be running on [GitLab Pages](https://docs.gitlab.com/ee/user/project/pages/getting_started_part_one.html) with a URL of `https://youruser.gitlab.io/reponame/`. Use this as the Origin URL.

![Screenshot of KeyCDN's pull zone creation page](/images/hosting-and-deployment/hosting-on-keycdn/keycdn-pull-zone.png)

Expand Down
2 changes: 1 addition & 1 deletion content/news/0-16.md
Expand Up @@ -90,7 +90,7 @@ times decreased anywhere from 10% to 99%.
* Add config layout and content directory CLI options {{<gh 1698>}}
* Add boolean value comparison to `where` template function {{<gh
0xf3c74c9db484c8961e70cb3458f9e41e7832fa12>}}
* Do not write to to cache when `ignoreCache` is set {{<gh 2067>}}
* Do not write to cache when `ignoreCache` is set {{<gh 2067>}}
* Add option to disable rendering of 404 page {{<gh 2037>}}
* Mercurial is no longer needed to build Hugo {{<gh 2062 >}}
* Do not create `robots.txt` by default {{<gh 2049>}}
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
50 changes: 50 additions & 0 deletions content/news/0.36-relnotes/index.md
@@ -0,0 +1,50 @@

---
date: 2018-02-05
title: "Hugo 0.36: Smart Image Cropping!"
description: "Hugo 0.36 announces smart image cropping and some important bug fixes."
categories: ["Releases"]
---

Hugo `0.36` announces **smart cropping** of images, using the [library](https://github.com/muesli/smartcrop) created by [muesli](https://github.com/muesli). We will work with him to improve this even more in the future, but this is now the default used when cropping images in Hugo.

Go [here](http://hugotest.bep.is/resourcemeta/smartcrop/) for a list of examples.

This release represents **7 contributions by 3 contributors** to the main Hugo code base.

Many have also been busy writing and fixing the documentation in [hugoDocs](https://github.com/gohugoio/hugoDocs),
which has received **9 contributions by 4 contributors**. A special thanks to [@bep](https://github.com/bep), [@Jibec](https://github.com/Jibec), [@Nick-Rivera](https://github.com/Nick-Rivera), and [@kaushalmodi](https://github.com/kaushalmodi) for their work on the documentation site.


Hugo now has:

* 23100+ [stars](https://github.com/gohugoio/hugo/stargazers)
* 448+ [contributors](https://github.com/gohugoio/hugo/graphs/contributors)
* 197+ [themes](http://themes.gohugo.io/)

## Notes
Hugo now defaults to **smart crop** when cropping images, if you don't specify it when calling `.Fill`.

You can get the old default by adding this to your `config.toml`:

```toml
[imaging]
anchor = "center"
```
Also, we have removed the superflous anchor name from the processed filenames that does not use this anchor, so it can be wise to run `hugo --gc` once to remove unused images.

## Enhancements
* Add smart cropping [722086b4](https://github.com/gohugoio/hugo/commit/722086b4ed3e77d1aba6724474bec06d08e7de06) [@bep](https://github.com/bep) [#4375](https://github.com/gohugoio/hugo/issues/4375)

## Fixes
* Ensure site templates can override theme templates [084cf419](https://github.com/gohugoio/hugo/commit/084cf4191b3c1e7590a4223fd9251019ef5d4c21) [@moorereason](https://github.com/moorereason) [#3505](https://github.com/gohugoio/hugo/issues/3505)
* Add additional test to `TestTemplateLookupOrder` [fc06d5c1](https://github.com/gohugoio/hugo/commit/fc06d5c18bb1e47f90f0297aa8121ee0775e047d) [@moorereason](https://github.com/moorereason) [#3505](https://github.com/gohugoio/hugo/issues/3505)
* Fix broken `TestTemplateLookupOrder` [9a367d9d](https://github.com/gohugoio/hugo/commit/9a367d9d06db6f6cf22121d0397c464ae36e7089) [@moorereason](https://github.com/moorereason)
* Fix JSON array-based data file handling regression [4402c077](https://github.com/gohugoio/hugo/commit/4402c077754991df19c3bbab0c4a671dcfdc192c) [@vassudanagunta](https://github.com/vassudanagunta) [#4361](https://github.com/gohugoio/hugo/issues/4361)
* Increase data directory test coverage [4743de0d](https://github.com/gohugoio/hugo/commit/4743de0d3c7564fc06972074e903d5502d204353) [@vassudanagunta](https://github.com/vassudanagunta) [#4138](https://github.com/gohugoio/hugo/issues/4138)






6 changes: 6 additions & 0 deletions content/showcase/hartwell-insurance/bio.md
@@ -0,0 +1,6 @@

Hartwell Insurance is an insurance company set up solely to service the Broker community.

By combining **Hugo**, **Service Worker** and **Netlify**, we were able to achieve incredible global site performance.

The site was built by [Tomango](http://www.tomango.co.uk)
Binary file added content/showcase/hartwell-insurance/featured.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
69 changes: 69 additions & 0 deletions content/showcase/hartwell-insurance/index.md
@@ -0,0 +1,69 @@
---

title: Hartwell Insurance

date: 2018-02-09

description: "Showcase: \"Hugo + Netlify + PWA makes for a rapid website.\""

siteURL: https://www.hartwell-insurance.com/

byline: "[Trys Mudford](http://www.trysmudford.com), Lead Developer, Tomango"

---

We’ve just launched a shiny new website for [Hartwell Insurance](https://www.hartwell-insurance.com/) – I’m really proud of it. It was tackled it in a different way to most previous Tomango site builds, using some fancy new tools and some vintage web standards.

It’s multi-page, single-page (!) website written in Hugo, a static site generator built with performance as a first-class feature. _I’ve outlined a load of benefits to Hugo & static sites [here](https://why-static.netlify.com/), in case you’re interested._

> **In essence, a static site generator pre-renders the whole site into HTML files and serves them like it’s 1995.**
There’s no Apache or Node backend that does compilation at runtime, it’s all done at the build step. This means the server; Netlify in this case, only has to do one thing – serve files. Unsurprisingly, serving simple files is VERY quick.

The starter point was the [victor-hugo](https://github.com/netlify/victor-hugo) repository that Netlify have created. It let me dive in with Hugo, PostCSS, BrowserSync and ES6 without setting up any tooling myself – always a win!

I then took all the content from the design file and moved it into Markdown, putting shortcodes in where necessary. This site did need a number of custom shortcodes for the presentational elements like the expanding circles and full width backgrounds. But mostly it was just clean, semantic HTML with some CSS and JS enhancement thrown in.

For example, this two column layout shown below. I used CSS Columns with a `break-after: always;` on the `<h1>`. No multi-wrapper or difficult-to-clear shortcodes, just clean HTML.

![The multi-column setup on Hartwell Insurance](hartwell-columns.png)

For the ripple effects on the section headings, I used JS to prepend a `<canvas>` element then animated it with `RequestAnimationFrame`. It adds a nice bit of movement on the page.

On the [Hartwell Profitmaker](https://www.hartwell-insurance.com/profitmaker/) section, I toyed with the idea of using Vue.js for the calculator, but after giving it some thought, I decided to code in Vanilla. The result, all of the site JS comes in at 3.2KB!

The plan was to host with Netlify and therefore get access to Netlify Forms. It meant spending 0 minutes on getting a backend set up – I could focus fully on the frontend.

Cache invalidation isn’t normally something I spend all that much time thinking about when building a site. But as this site was going to be a Progressive Web App, invalidating files would be important to ensure the site didn’t appear broken when we made changes. As I was using Victor-Hugo, I wasn’t really sure how to best tackle this and sadly spent far too many hours wrangling with Webpack and Gulp files to try and get hashed file names working nicely.

Then; while I was waiting for a haircut, I read a [Netlify blog post](https://www.netlify.com/blog/2017/02/23/better-living-through-caching/) on how they do cache invalidation with HTTP2 and it promptly blew my mind.

When you request an asset, they send an ETag in the headers which is a hash of the file. There’s also a header to tell the browser not to trust it’s own cache (which sounds a little bit bonkers).

So when you request the page, it opens a persistent HTTP2 connection up (so no new connections for file requests). When it gets to requesting that asset, the browser sends the ETag back to Netlify and they either return nothing if the ETag matches, or the new file with the new ETag. No `app.klfjlkdsfjdslkfjdslkfdsj.js` or `app.js?v=20180112`. Just a clean `app.js` with instant cache invalidation. Amazing.

Finally, the [Service Worker](https://www.hartwell-insurance.com/sw.js) could be added. This turned out to be straightforward as the Netlify cache invalidation system solved most of the pain points. I went for a network-first, cache-fallback setup for both assets and HTML. This does mean flaky speeds are reliant on the page connection time, but given we’re on HTTP2, I’m hoping the persistent connection and tiny ETag size will keep it quick. For online connections, every request is up to date and instantly live after any update. Offline connections fall back to every assets’ last cached state. It seems to work really nicely, and there’s no need for an update prompt if assets have changed.

---

## The results

The WebPageTest results are looking good. The speed index is 456, 10x smaller than the average Alexa top 300,000 score.

![WebPageTest results](hartwell-webpagetest.png)

[TestMySite.io](https://testmysite.io/5a7e1bb2df99531a23c9ad2f/hartwell-insurance.com) is return ~2ms time to first byte from the CDN edge nodes. Lighthouse audits are also very promising. There’s still some improvement to be gained lazy-loading the images and inlining the CSS. I’m less excited about the [second suggestion](http://www.trysmudford.com/css-in-2017/), but I’ll certainly look at some lazy-loading, especially as I’m already using `IntersectionObserver` for some animations.

![Lighthouse results](hartwell-lighthouse.png)

The most encouraging result is how quick the site is around the world. Most Tomango clients (and their customers) are pretty local and almost exclusively UK-based. We have a dedicated server in Surrey that serves our market pretty well. It did take me by surprise just how much slower a connection from the USA, Australia and Japan to our server was. They’re waiting ~500ms just for the first byte, let alone downloading each asset.

[Hartwell Insurance](https://www.hartwell-insurance.com/) are a US company so by putting them on our server, we’d be instantly hampering their local response times by literally seconds. This was one of the main reasons for going with Netlify. They provide global CDN hosting that’s quick from anywhere in the world.

---

This project was such a blast to develop, it’s a real pleasure to put new technologies to good use in production, and to see real performance and usability benefits from them. Even using classic web methods of serving folders with files is fun when you’ve been databasing for a while – there’s something really ‘pure’ about it.

---

_This was originally posted on [my website](http://www.trysmudford.com/perfomance-wins-with-hugo-and-netlify/)_
4 changes: 4 additions & 0 deletions content/showcase/pace-revenue-management/bio.md
@@ -0,0 +1,4 @@

Pace was started in 2016 to give hotels the super-power to always have the right price.

We've been using **Hugo+Gulp** from the very beginning and the workflow is proving to scale incredibly well with us as we grow the team and business.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 9cc9bab

Please sign in to comment.