diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2019-10-21 10:21:37 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2019-10-21 10:21:51 +0200 |
commit | 39121de4d991bdcf5f202da4d8d81a8ac6c149fc (patch) | |
tree | 97e0b638fea1d898de9e297732d1044b49bfba8e /docs/content/en/about | |
parent | 180195aa342777fece1b29a08ec89456d7996c61 (diff) |
docs: Replace /docs
Diffstat (limited to 'docs/content/en/about')
-rw-r--r-- | docs/content/en/about/_index.md | 20 | ||||
-rw-r--r-- | docs/content/en/about/benefits.md | 43 | ||||
-rw-r--r-- | docs/content/en/about/features.md | 87 | ||||
-rw-r--r-- | docs/content/en/about/hugo-and-gdpr.md | 135 | ||||
-rw-r--r-- | docs/content/en/about/license.md | 165 | ||||
-rw-r--r-- | docs/content/en/about/new-in-032/index.md | 209 | ||||
-rw-r--r-- | docs/content/en/about/new-in-032/sunset.jpg | bin | 90587 -> 0 bytes | |||
-rw-r--r-- | docs/content/en/about/what-is-hugo.md | 65 |
8 files changed, 0 insertions, 724 deletions
diff --git a/docs/content/en/about/_index.md b/docs/content/en/about/_index.md deleted file mode 100644 index 8ed441b61..000000000 --- a/docs/content/en/about/_index.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -title: About Hugo -linktitle: Overview -description: Hugo's features, roadmap, license, and motivation. -date: 2017-02-01 -publishdate: 2017-02-01 -lastmod: 2017-02-01 -categories: [] -keywords: [] -menu: - docs: - parent: "about" - weight: 1 -weight: 1 -draft: false -aliases: [/about-hugo/,/docs/] -toc: false ---- - -Hugo is not your average static site generator. diff --git a/docs/content/en/about/benefits.md b/docs/content/en/about/benefits.md deleted file mode 100644 index 0ba28c5cc..000000000 --- a/docs/content/en/about/benefits.md +++ /dev/null @@ -1,43 +0,0 @@ ---- -title: The Benefits of Static Site Generators -linktitle: The Benefits of Static -description: Improved performance, security and ease of use are just a few of the reasons static site generators are so appealing. -date: 2017-02-01 -publishdate: 2017-02-01 -lastmod: 2017-02-01 -keywords: [ssg,static,performance,security] -menu: - docs: - parent: "about" - weight: 30 -weight: 30 -sections_weight: 30 -draft: false -aliases: [] -toc: false ---- - -The purpose of website generators is to render content into HTML files. Most are "dynamic site generators." That means the HTTP server---i.e., the program that sends files to the browser to be viewed---runs the generator to create a new HTML file every time an end user requests a page. - -Over time, dynamic site generators were programmed to cache their HTML files to prevent unnecessary delays in delivering pages to end users. A cached page is a static version of a web page. - -Hugo takes caching a step further and all HTML files are rendered on your computer. You can review the files locally before copying them to the computer hosting the HTTP server. Since the HTML files aren't generated dynamically, we say that Hugo is a *static site generator*. - -This has many benefits. The most noticeable is performance. HTTP servers are *very* good at sending files---so good, in fact, that you can effectively serve the same number of pages with a fraction of the memory and CPU needed for a dynamic site. - -## More on Static Site Generators - -* ["An Introduction to Static Site Generators", David Walsh][] -* ["Hugo vs. Wordpress page load speed comparison: Hugo leaves WordPress in its dust", GettingThingsTech][hugovwordpress] -* ["Static Site Generators", O'Reilly][] -* [StaticGen: Top Open-Source Static Site Generators (GitHub Stars)][] -* ["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]: http://www.oreilly.com/web-platform/free/files/static-site-generators.pdf -["Top 10 Static Website Generators", Netlify blog]: https://www.netlify.com/blog/2016/05/02/top-ten-static-website-generators/ -[hugovwordpress]: https://gettingthingstech.com/hugo-vs.-wordpress-page-load-speed-comparison-hugo-leaves-wordpress-in-its-dust/ -[StaticGen: Top Open-Source Static Site Generators (GitHub Stars)]: https://www.staticgen.com/ -[dotcms]: https://dotcms.com/blog/post/the-resurgence-of-static diff --git a/docs/content/en/about/features.md b/docs/content/en/about/features.md deleted file mode 100644 index 4176c60df..000000000 --- a/docs/content/en/about/features.md +++ /dev/null @@ -1,87 +0,0 @@ ---- -title: Hugo Features -linktitle: Hugo Features -description: Hugo boasts blistering speed, robust content management, and a powerful templating language making it a great fit for all kinds of static websites. -date: 2017-02-01 -publishdate: 2017-02-01 -lastmod: 2017-02-01 -menu: - docs: - parent: "about" - weight: 20 -weight: 20 -sections_weight: 20 -draft: false -toc: true ---- - -## General - -* [Extremely fast][] build times (< 1 ms per page) -* Completely cross platform, with [easy installation][install] on macOS, Linux, Windows, and more -* Renders changes on the fly with [LiveReload][] as you develop -* [Powerful theming][] -* [Host your site anywhere][hostanywhere] - -## Organization - -* Straightforward [organization for your projects][], including website sections -* Customizable [URLs][] -* Support for configurable [taxonomies][], including categories and tags -* [Sort content][] as you desire through powerful template [functions][] -* Automatic [table of contents][] generation -* [Dynamic menu][] creation -* [Pretty URLs][] support -* [Permalink][] pattern support -* Redirects via [aliases][] - -## Content - -* Native Markdown and Emacs Org-Mode support, as well as other languages via *external helpers* (see [supported formats][]) -* TOML, YAML, and JSON metadata support in [front matter][] -* Customizable [homepage][] -* Multiple [content types][] -* Automatic and user defined [content summaries][] -* [Shortcodes][] to enable rich content inside of Markdown -* ["Minutes to Read"][pagevars] functionality -* ["Wordcount"][pagevars] functionality - -## Additional Features - -* Integrated [Disqus][] comment support -* Integrated [Google Analytics][] support -* Automatic [RSS][] creation -* Support for [Go][], [Amber], and [Ace][] HTML templates -* [Syntax highlighting][] powered by [Chroma][] (partly compatible with Pygments) - - -[Ace]: /templates/alternatives/ -[aliases]: /content-management/urls/#aliases -[Amber]: https://github.com/eknkc/amber -[Chroma]: https://github.com/alecthomas/chroma -[content summaries]: /content-management/summaries/ -[content types]: /content-management/types/ -[Disqus]: https://disqus.com/ -[Dynamic menu]: /templates/menus/ -[Extremely fast]: https://github.com/bep/hugo-benchmark -[front matter]: /content-management/front-matter/ -[functions]: /functions/ -[Go]: http://golang.org/pkg/html/template/ -[Google Analytics]: https://google-analytics.com/ -[homepage]: /templates/homepage/ -[hostanywhere]: /hosting-and-deployment/ -[install]: /getting-started/installing/ -[LiveReload]: /getting-started/usage/ -[organization for your projects]: /getting-started/directory-structure/ -[pagevars]: /variables/page/ -[Permalink]: /content-management/urls/#permalinks -[Powerful theming]: /themes/ -[Pretty URLs]: /content-management/urls/ -[RSS]: /templates/rss/ -[Shortcodes]: /content-management/shortcodes/ -[sort content]: /templates/ -[supported formats]: /content-management/formats/ -[Syntax highlighting]: /tools/syntax-highlighting/ -[table of contents]: /content-management/toc/ -[taxonomies]: /content-management/taxonomies/ -[URLs]: /content-management/urls/ diff --git a/docs/content/en/about/hugo-and-gdpr.md b/docs/content/en/about/hugo-and-gdpr.md deleted file mode 100644 index e193e1838..000000000 --- a/docs/content/en/about/hugo-and-gdpr.md +++ /dev/null @@ -1,135 +0,0 @@ - - ---- -title: Hugo and the General Data Protection Regulation (GDPR) -linktitle: Hugo and GDPR -description: About how to configure your Hugo site to meet the new regulations. -date: 2018-05-25 -layout: single -keywords: ["GDPR", "Privacy", "Data Protection"] -menu: - docs: - parent: "about" - weight: 5 -weight: 5 -sections_weight: 5 -draft: false -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.** - - But even static websites can integrate with external services, so from version `0.41`, Hugo provides a **Privacy Config** that covers the relevant built-in templates. - - Note that: - - * These settings have their defaults setting set to _off_, i.e. how it worked before Hugo `0.41`. You must do your own evaluation of your site and apply the appropriate settings. - * These settings work with the [internal templates](/templates/internal/). Some theme may contain custom templates for embedding services like Google Analytics. In that case these options have no effect. - * We will continue this work and improve this further in future Hugo versions. - -## All Privacy Settings - -Below are all privacy settings and their default value. These settings need to be put in your site config (e.g. `config.toml`). - - {{< code-toggle file="config">}} -[privacy] -[privacy.disqus] -disable = false -[privacy.googleAnalytics] -disable = false -respectDoNotTrack = false -anonymizeIP = false -useSessionStorage = false -[privacy.instagram] -disable = false -simple = false -[privacy.twitter] -disable = false -enableDNT = false -simple = false -[privacy.vimeo] -disable = false -simple = false -[privacy.youtube] -disable = false -privacyEnhanced = false -{{< /code-toggle >}} - - -## Disable All Services - -An example Privacy Config that disables all the relevant services in Hugo. With this configuration, the other settings will not matter. - - {{< code-toggle file="config">}} -[privacy] -[privacy.disqus] -disable = true -[privacy.googleAnalytics] -disable = true -[privacy.instagram] -disable = true -[privacy.twitter] -disable = true -[privacy.vimeo] -disable = true -[privacy.youtube] -disable = true -{{< /code-toggle >}} - -## The Privacy Settings Explained - -### GoogleAnalytics - -anonymizeIP -: Enabling this will make it so the users' IP addresses are anonymized within Google Analytics. - -respectDoNotTrack -: Enabling this will make the GA templates respect the "Do Not Track" HTTP header. - -useSessionStorage -: Enabling this will disable the use of Cookies and use Session Storage to Store the GA Client ID. - -### Instagram - -simple -: If simple mode is enabled, a static and no-JS version of the Instagram image card will be built. Note that this only supports image cards and the image itself will be fetched from Instagram's servers. - -**Note:** If you use the _simple mode_ for Instagram and a site styled with Bootstrap 4, you may want to disable the inlines styles provided by Hugo: - - {{< code-toggle file="config">}} -[services] -[services.instagram] -disableInlineCSS = true -{{< /code-toggle >}} - -### Twitter - -enableDNT -: Enabling this for the twitter/tweet shortcode, the tweet and its embedded page on your site are not used for purposes that include personalized suggestions and personalized ads. - -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: - - {{< code-toggle file="config">}} -[services] -[services.twitter] -disableInlineCSS = true -{{< /code-toggle >}} - -### YouTube - -privacyEnhanced -: When you turn on privacy-enhanced mode, YouTube won’t store information about visitors on your website unless the user plays the embedded video. - -### Vimeo - -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. - diff --git a/docs/content/en/about/license.md b/docs/content/en/about/license.md deleted file mode 100644 index a8e7c4abd..000000000 --- a/docs/content/en/about/license.md +++ /dev/null @@ -1,165 +0,0 @@ ---- -title: Apache License -linktitle: License -description: Hugo v0.15 and later are released under the Apache 2.0 license. -date: 2016-02-01 -publishdate: 2016-02-01 -lastmod: 2016-03-02 -categories: ["about hugo"] -keywords: ["License","apache"] -menu: - docs: - parent: "about" - weight: 60 -weight: 60 -sections_weight: 60 -aliases: [/meta/license] -toc: true ---- - -{{% note %}} -Hugo v0.15 and later are released under the Apache 2.0 license. -Earlier versions of Hugo were released under the [Simple Public License](https://opensource.org/licenses/Simple-2.0). -{{% /note %}} - -_Version 2.0, January 2004_ <br> -<http://www.apache.org/licenses/LICENSE-2.0> - -*Terms and Conditions for use, reproduction, and distribution* - -## 1. Definitions - -“License” shall mean the terms and conditions for use, reproduction, and -distribution as defined by Sections 1 through 9 of this document. - -“Licensor” shall mean the copyright owner or entity authorized by the copyright -owner that is granting the License. - -“Legal Entity” shall mean the union of the acting entity and all other entities -that control, are controlled by, or are under common control with that entity. -For the purposes of this definition, “control” means **(i)** the power, direct or -indirect, to cause the direction or management of such entity, whether by -contract or otherwise, or **(ii)** ownership of fifty percent (50%) or more of the -outstanding shares, or **(iii)** beneficial ownership of such entity. - -“You” (or “Your”) shall mean an individual or Legal Entity exercising -permissions granted by this License. - -“Source” form shall mean the preferred form for making modifications, including -but not limited to software source code, documentation source, and configuration -files. - -“Object” form shall mean any form resulting from mechanical transformation or -translation of a Source form, including but not limited to compiled object code, -generated documentation, and conversions to other media types. - -“Work” shall mean the work of authorship, whether in Source or Object form, made -available under the License, as indicated by a copyright notice that is included -in or attached to the work (an example is provided in the Appendix below). - -“Derivative Works” shall mean any work, whether in Source or Object form, that -is based on (or derived from) the Work and for which the editorial revisions, -annotations, elaborations, or other modifications represent, as a whole, an -original work of authorship. For the purposes of this License, Derivative Works -shall not include works that remain separable from, or merely link (or bind by -name) to the interfaces of, the Work and Derivative Works thereof. - -“Contribution” shall mean any work of authorship, including the original version -of the Work and any modifications or additions to that Work or Derivative Works -thereof, that is intentionally submitted to Licensor for inclusion in the Work -by the copyright owner or by an individual or Legal Entity authorized to submit -on behalf of the copyright owner. For the purposes of this definition, -“submitted” means any form of electronic, verbal, or written communication sent -to the Licensor or its representatives, including but not limited to -communication on electronic mailing lists, source code control systems, and -issue tracking systems that are managed by, or on behalf of, the Licensor for -the purpose of discussing and improving the Work, but excluding communication -that is conspicuously marked or otherwise designated in writing by the copyright -owner as “Not a Contribution.” - -“Contributor” shall mean Licensor and any individual or Legal Entity on behalf -of whom a Contribution has been received by Licensor and subsequently -incorporated within the Work. - -## 2. Grant of Copyright License - -Subject to the terms and conditions of this License, each Contributor hereby -grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, -irrevocable copyright license to reproduce, prepare Derivative Works of, -publicly display, publicly perform, sublicense, and distribute the Work and such -Derivative Works in Source or Object form. - -## 3. Grant of Patent License - -Subject to the terms and conditions of this License, each Contributor hereby -grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, -irrevocable (except as stated in this section) patent license to make, have -made, use, offer to sell, sell, import, and otherwise transfer the Work, where -such license applies only to those patent claims licensable by such Contributor -that are necessarily infringed by their Contribution(s) alone or by combination -of their Contribution(s) with the Work to which such Contribution(s) was -submitted. If You institute patent litigation against any entity (including a -cross-claim or counterclaim in a lawsuit) alleging that the Work or a -Contribution incorporated within the Work constitutes direct or contributory -patent infringement, then any patent licenses granted to You under this License -for that Work shall terminate as of the date such litigation is filed. - -## 4. Redistribution - -You may reproduce and distribute copies of the Work or Derivative Works thereof -in any medium, with or without modifications, and in Source or Object form, -provided that You meet the following conditions: - -* **(a)** You must give any other recipients of the Work or Derivative Works a copy of -this License; and -* **(b)** You must cause any modified files to carry prominent notices stating that You -changed the files; and -* **\(c)** You must retain, in the Source form of any Derivative Works that You distribute, -all copyright, patent, trademark, and attribution notices from the Source form -of the Work, excluding those notices that do not pertain to any part of the -Derivative Works; and -* **(d)** If the Work includes a “NOTICE” text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. - -You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. - -## 5. Submission of Contributions - -Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. - -## 6. Trademarks - -This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. - -## 7. Disclaimer of Warranty - -Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. - -## 8. Limitation of Liability - -In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. - -## 9. Accepting Warranty or Additional Liability - -While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. - -_END OF TERMS AND CONDITIONS_ - -## APPENDIX: How to apply the Apache License to your work - -To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets `[]` replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same “printed page” as the copyright notice for easier identification within third-party archives. - -{{< code file="apache-notice.txt" download="apache-notice.txt" >}} -Copyright [yyyy] [name of copyright owner] - -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. -{{< /code >}} diff --git a/docs/content/en/about/new-in-032/index.md b/docs/content/en/about/new-in-032/index.md deleted file mode 100644 index f3e56dc6b..000000000 --- a/docs/content/en/about/new-in-032/index.md +++ /dev/null @@ -1,209 +0,0 @@ ---- -title: Hugo 0.32 HOWTO -description: About page bundles, image processing and more. -date: 2017-12-28 -keywords: [ssg,static,performance,security] -menu: - docs: - parent: "about" - weight: 10 -weight: 10 -sections_weight: 10 -draft: false -aliases: [] -toc: true -images: -- images/blog/sunset.jpg ---- - - -{{% note %}} -This documentation belongs in other places in this documentation site, but is put here first ... to get something up and running fast. -{{% /note %}} - - -Also see this demo project from [bep](https://github.com/bep/), the clever Norwegian behind these new features: - -* https://temp.bep.is/hugotest/ -* https://github.com/bep/hugotest (source) - -## Page Resources - -### Organize Your Content - -{{< figure src="/images/hugo-content-bundles.png" title="Pages with image resources" >}} - -The content folder above shows a mix of content pages (`md` (i.e. markdown) files) and image resources. - -{{% note %}} -You can use any file type as a content resource as long as it is a MIME type recognized by Hugo (`json` files will, as one example, work fine). If you want to get exotic, you can define your [own media type](/templates/output-formats/#media-types). -{{% /note %}} - -The 3 page bundles marked in red explained from top to bottom: - -1. The home page with one image resource (`1-logo.png`) -2. The blog section with two images resources and two pages resources (`content1.md`, `content2.md`). Note that the `_index.md` represents the URL for this section. -3. An article (`hugo-is-cool`) with a folder with some images and one content resource (`cats-info.md`). Note that the `index.md` represents the URL for this article. - -The content files below `blog/posts` are just regular standalone pages. - -{{% note %}} -Note that changes to any resource inside the `content` folder will trigger a reload when running in watch (aka server or live reload mode), it will even work with `--navigateToChanged`. -{{% /note %}} - -#### Sort Order - -* Pages are sorted according to standard Hugo page sorting rules. -* Images and other resources are sorted in lexicographical order. - -### Handle Page Resources in Templates - - -#### List all Resources - -```go-html-template -{{ range .Resources }} -<li><a href="{{ .RelPermalink }}">{{ .ResourceType | title }}</a></li> -{{ end }} -``` - -For an absolute URL, use `.Permalink`. - -**Note:** The permalink will be relative to the content page, respecting permalink settings. Also, included page resources will not have a value for `RelPermalink`. - -#### List All Resources by Type - -```go-html-template -{{ with .Resources.ByType "image" }} -{{ end }} - -``` - -Type here is `page` for pages, else the main type in the MIME type, so `image`, `json` etc. - -#### Get a Specific Resource - -```go-html-template -{{ $logo := .Resources.GetByPrefix "logo" }} -{{ with $logo }} -{{ end }} -``` - -#### Include Page Resource Content - -```go-html-template -{{ with .Resources.ByType "page" }} -{{ range . }} -<h3>{{ .Title }}</h3> -{{ .Content }} -{{ end }} -{{ end }} - -``` - - -## Image Processing - -The `image` resource implements the methods `Resize`, `Fit` and `Fill`: - -Resize -: Resize to the given dimension, `{{ $logo.Resize "200x" }}` will resize to 200 pixels wide and preserve the aspect ratio. Use `{{ $logo.Resize "200x100" }}` to control both height and width. - -Fit -: Scale down the image to fit the given dimensions, e.g. `{{ $logo.Fit "200x100" }}` will fit the image inside a box that is 200 pixels wide and 100 pixels high. - -Fill -: Resize and crop the image given dimensions, e.g. `{{ $logo.Fill "200x100" }}` will resize and crop to width 200 and height 100 - - -{{% note %}} -Image operations in Hugo currently **do not preserve EXIF data** as this is not supported by Go's [image package](https://github.com/golang/go/search?q=exif&type=Issues&utf8=%E2%9C%93). This will be improved on in the future. -{{% /note %}} - - -### Image Processing Examples - -_The photo of the sunset used in the examples below is Copyright [Bjørn Erik Pedersen](https://commons.wikimedia.org/wiki/User:Bep) (Creative Commons Attribution-Share Alike 4.0 International license)_ - - -{{< imgproc sunset Resize "300x" />}} - -{{< imgproc sunset Fill "90x120 left" />}} - -{{< imgproc sunset Fill "90x120 right" />}} - -{{< imgproc sunset Fit "90x90" />}} - -{{< imgproc sunset Resize "300x q10" />}} - - -This is the shortcode used in the examples above: - - -{{< code file="layouts/shortcodes/imgproc.html" >}} -{{< readfile file="layouts/shortcodes/imgproc.html" >}} -{{< /code >}} - -And it is used like this: - -```go-html-template -{{</* imgproc sunset Resize "300x" */>}} -``` - -### Image Processing Options - -In addition to the dimensions (e.g. `200x100`) where either height or width can be omitted, Hugo supports a set of additional image options: - -Anchor -: Only relevant for `Fill`. This is useful for thumbnail generation where the main motive is located in, say, the left corner. Valid are `Center`, `TopLeft`, `Top`, `TopRight`, `Left`, `Right`, `BottomLeft`, `Bottom`, `BottomRight`. Example: `{{ $logo.Fill "200x100 BottomLeft" }}` - -JPEG Quality -: Only relevant for JPEG images, values 1 to 100 inclusive, higher is better. Default is 75. `{{ $logo.Resize "200x q50" }}` - -Rotate -: Rotates an image by the given angle counter-clockwise. The rotation will be performed first to get the dimensions correct. `{{ $logo.Resize "200x r90" }}`. The main use of this is to be able to manually correct for [EXIF orientation](https://github.com/golang/go/issues/4341) of JPEG images. - -Resample Filter -: Filter used in resizing. Default is `Box`, a simple and fast resampling filter appropriate for downscaling. See https://github.com/disintegration/imaging for more. If you want to trade quality for faster processing, this may be a option to test. - - - -### Performance - -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 %}} - - -## Configuration - -### Default 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" - -# Default JPEG quality setting. Default is 75. -quality = 68 -``` |