diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2018-01-31 11:08:08 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2018-01-31 11:08:08 +0100 |
commit | 158e1151cdfbdebd2e4a527e828d8a0b17933787 (patch) | |
tree | b73947184a82fe10366dbefe7e3f2d0e415ae801 | |
parent | f0c0ece44d55b6c2997cbd106d1bc099ea1a2fa7 (diff) | |
parent | 337d0c5f516ee085205e8abefdb7f87e6d33ca05 (diff) |
Merge commit '337d0c5f516ee085205e8abefdb7f87e6d33ca05'
58 files changed, 1333 insertions, 504 deletions
diff --git a/docs/archetypes/default.md b/docs/archetypes/default.md index 42eb9e04e..f30f01f74 100644 --- a/docs/archetypes/default.md +++ b/docs/archetypes/default.md @@ -1,11 +1,13 @@ --- -title: "{{ replace .TranslationBaseName "-" " " | title }}" -date: {{ .Date }} +linktitle: "" description: "" +godocref: "" +publishdate: "" +lastmod: "" categories: [] -keywords: [] +tags: [] +weight: 00 slug: "" aliases: [] toc: false -draft: true ---- +---
\ No newline at end of file diff --git a/docs/themes/gohugoioTheme/archetypes/functions.md b/docs/archetypes/functions.md index 0a5dd344f..0a5dd344f 100644 --- a/docs/themes/gohugoioTheme/archetypes/functions.md +++ b/docs/archetypes/functions.md diff --git a/docs/config.toml b/docs/config.toml index 346b66d03..61fd44303 100644 --- a/docs/config.toml +++ b/docs/config.toml @@ -98,7 +98,8 @@ twitter = "GoHugoIO" ## Configuration for BlackFriday markdown parser: https://github.com/russross/blackfriday [blackfriday] plainIDAnchors = true - hrefTargetBlank = true + # See https://github.com/gohugoio/hugo/issues/2424 + hrefTargetBlank = false angledQuotes = false latexDashes = true diff --git a/docs/content/about/features.md b/docs/content/about/features.md index f3f490cba..9d29c5bd3 100644 --- a/docs/content/about/features.md +++ b/docs/content/about/features.md @@ -55,7 +55,6 @@ toc: true * Support for [Go][], [Amber], and [Ace][] HTML templates * [Syntax highlighting][] powered by [Pygments][] -See what's coming next in the [Hugo roadmap][]. [Ace]: /templates/alternatives/ [aliases]: /content-management/urls/#aliases @@ -71,7 +70,6 @@ See what's coming next in the [Hugo roadmap][]. [Google Analytics]: https://google-analytics.com/ [homepage]: /templates/homepage/ [hostanywhere]: /hosting-and-deployment/ -[Hugo roadmap]: /about/roadmap [install]: /getting-started/installing/ [LiveReload]: /getting-started/usage/ [organization for your projects]: /getting-started/directory-structure/ diff --git a/docs/content/about/new-in-032/index.md b/docs/content/about/new-in-032/index.md index 0ae93b557..41bd58937 100644 --- a/docs/content/about/new-in-032/index.md +++ b/docs/content/about/new-in-032/index.md @@ -126,15 +126,15 @@ Image operations in Hugo currently **do not preserve EXIF data** as this is not _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 Resize "300x" />}} -{{< imgproc sunset Fill "90x120 left" >}} +{{< imgproc sunset Fill "90x120 left" />}} -{{< imgproc sunset Fill "90x120 right" >}} +{{< imgproc sunset Fill "90x120 right" />}} -{{< imgproc sunset Fit "90x90" >}} +{{< imgproc sunset Fit "90x90" />}} -{{< imgproc sunset Resize "300x q10" >}} +{{< imgproc sunset Resize "300x q10" />}} This is the shortcode used in the examples above: diff --git a/docs/content/about/what-is-hugo.md b/docs/content/about/what-is-hugo.md index c61fa2d40..db947e2f9 100644 --- a/docs/content/about/what-is-hugo.md +++ b/docs/content/about/what-is-hugo.md @@ -19,7 +19,7 @@ toc: true Hugo is a general-purpose website framework. Technically speaking, Hugo is a [static site generator][]. Unlike systems that dynamically build a page with each visitor request, Hugo builds pages when you create or update your content. Since websites are viewed far more often than they are edited, Hugo is designed to provide an optimal viewing experience for your website's end users and an ideal writing experience for website authors. -Websites built with Hugo are extremely fast and secure. Hugo sites can be hosted anywhere, including [Netlify][], [Heroku][], [GoDaddy][], [DreamHost][], [GitHub Pages][], [Surge][], [Aerobatic][], [Firebase][], [Google Cloud Storage][], [Amazon S3][], [Rackspace][], [Azure][], and [CloudFront][] and work well with CDNs. Hugo sites run without the need for a database or dependencies on expensive runtimes like Ruby, Python, or PHP. +Websites built with Hugo are extremely fast and secure. Hugo sites can be hosted anywhere, including [Netlify][], [Heroku][], [GoDaddy][], [DreamHost][], [GitHub Pages][], [GitLab Pages][], [Surge][], [Aerobatic][], [Firebase][], [Google Cloud Storage][], [Amazon S3][], [Rackspace][], [Azure][], and [CloudFront][] and work well with CDNs. Hugo sites run without the need for a database or dependencies on expensive runtimes like Ruby, Python, or PHP. We think of Hugo as the ideal website creation tool with nearly instant build times, able to rebuild whenever a change is made. @@ -50,7 +50,7 @@ Hugo is for people building a blog, a company site, a portfolio site, documentat [DreamHost]: http://www.dreamhost.com/ [Firebase]: https://firebase.google.com/docs/hosting/ "Firebase static hosting" [GitHub Pages]: https://pages.github.com/ -[GitLab]: https://about.gitlab.com +[GitLab Pages]: https://about.gitlab.com/features/pages/ [Go language]: https://golang.org/ [GoDaddy]: https://www.godaddy.com/ "Godaddy.com Hosting" [Google Cloud Storage]: http://cloud.google.com/storage/ diff --git a/docs/content/content-management/archetypes.md b/docs/content/content-management/archetypes.md index c6b8bde76..269fda6db 100644 --- a/docs/content/content-management/archetypes.md +++ b/docs/content/content-management/archetypes.md @@ -173,7 +173,7 @@ title = "post from custom archetype" As an example of archetypes in practice, the following is the `functions` archetype from the Hugo docs: {{< code file="archetypes/functions.md" >}} -{{< readfile file="/themes/gohugoioTheme/archetypes/functions.md" >}} +{{< readfile file="/archetypes/functions.md" >}} {{< /code >}} {{% note %}} diff --git a/docs/content/content-management/front-matter.md b/docs/content/content-management/front-matter.md index b9123db23..01afb2e60 100644 --- a/docs/content/content-management/front-matter.md +++ b/docs/content/content-management/front-matter.md @@ -103,6 +103,9 @@ There are a few predefined variables that Hugo is aware of. See [Page Variables] `expiryDate` : the datetime at which the content should no longer be published by Hugo; expired content will not be rendered unless the `--buildExpired` flag is passed to the `hugo` command. +`headless` +: if `true`, sets a leaf bundle to be [headless][headless-bundle]. + `isCJKLanguage` : if `true`, Hugo will explicitly treat the content as a CJK language; both `.Summary` and `.WordCount` work properly in CJK languages. @@ -127,6 +130,9 @@ There are a few predefined variables that Hugo is aware of. See [Page Variables] `publishDate` : if in the future, content will not be rendered unless the `--buildFuture` flag is passed to `hugo`. +`resources` +: used for configuring page bundle resources. See [Page Resources][page-resources]. + `slug` : appears as the tail of the output URL. A value specified in front matter will override the segment of the URL based on the filename. @@ -186,11 +192,13 @@ It's possible to set some options for Markdown rendering in a content's front ma [content type]: /content-management/types/ [contentorg]: /content-management/organization/ [definetype]: /content-management/types/#defining-a-content-type "Learn how to specify a type and a layout in a content's front matter" +[headless-bundle]: /content-management/page-bundles/#headless-bundle [json]: https://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf "Specification for JSON, JavaScript Object Notation" [lists]: /templates/lists/#ordering-content "See how to order content in list pages; for example, templates that look to specific _index.md for content and front matter." [lookup]: /templates/lookup-order/ "Hugo traverses your templates in a specific order when rendering content to allow for DRYer templating." [ordering]: /templates/lists/ "Hugo provides multiple ways to sort and order your content in list templates" [outputs]: /templates/output-formats/ "With the release of v22, you can output your content to any text format using Hugo's familiar templating" +[page-resources]: /content-management/page-resources/ [pagevars]: /variables/page/ [section]: /content-management/sections/ [taxweight]: /content-management/taxonomies/ diff --git a/docs/content/content-management/image-processing/index.md b/docs/content/content-management/image-processing/index.md new file mode 100644 index 000000000..d31f28dce --- /dev/null +++ b/docs/content/content-management/image-processing/index.md @@ -0,0 +1,141 @@ +--- +title: "Image Processing" +description: "Image Page resources can be resized and cropped." +date: 2018-01-24T13:10:00-05:00 +lastmod: 2018-01-26T15:59:07-05:00 +linktitle: "Image Processing" +categories: ["content management"] +keywords: [bundle,content,resources,images] +weight: 4004 +draft: false +toc: true +menu: + docs: + parent: "content-management" + weight: 32 +--- + +## The Image Page Resource + +The `image` is a [Page Resource]({{< relref "content-management/page-resources" >}}), and the processing methods listed below does not work on images inside your `/static` folder. + + +To get all images in a [Page Bundle]({{< relref "content-management/organization#page-bundles" >}}): + + +```html +{{ with .Resources.ByType "image" }} +{{ end }} + +``` + +## Image Processing Methods + + +The `image` resource implements the methods `Resize`, `Fit` and `Fill`, each returning the transformed image using the specified dimensions and processing options. + +Resize +: Resizes the image to the specified width and height. + +```go +// Resize to a width of 600px and preserve ratio +{{ $image := $resource.Resize "600x" }} + +// Resize to a height of 400px and preserve ratio +{{ $image := $resource.Resize "x400" }} + +// Resize to a width 600px and a height of 400px +{{ $image := $resource.Resize "600x400" }} +``` + +Fit +: Scale down the image to fit the given dimensions while maintaining aspect ratio. Both height and width are required. + +```go +{{ $image := $resource.Fit "600x400" }} +``` + +Fill +: Resize and crop the image to match the given dimensions. Both height and width are required. + +```go +{{ $image := $resource.Fill "600x400" }} +``` + + +{{% 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 Options + +In addition to the dimensions (e.g. `600x400`), Hugo supports a set of additional image options. + + +JPEG Quality +: Only relevant for JPEG images, values 1 to 100 inclusive, higher is better. Default is 75. + +```go +{{ $image.Resize "600x q50" }} +``` + +Rotate +: Rotates an image by the given angle counter-clockwise. The rotation will be performed first to get the dimensions correct. 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. + +```go +{{ $image.Resize "600x r90" }} +``` + +Anchor +: Only relevant for the `Fill` method. 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`. + +```go +{{ $image.Fill "300x200 BottomLeft" }} +``` + +Resample Filter +: Filter used in resizing. Default is `Box`, a simple and fast resampling filter appropriate for downscaling. + +Examples are: `Box`, `NearestNeighbor`, `Linear`, `Gaussian`. + +See https://github.com/disintegration/imaging for more. If you want to trade quality for faster processing, this may be a option to test. + +```go +{{ $image.Resize "600x400 Gaussian" }} +``` + +### 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: + +```html +{{</* imgproc sunset Resize "300x" /*/>}} +``` + + +{{% note %}} +**Tip:** Note the self-closing shortcode syntax above. The `imgproc` shortcode can be called both with and without **inner content**. +{{% /note %}}
\ No newline at end of file diff --git a/docs/content/content-management/image-processing/sunset.jpg b/docs/content/content-management/image-processing/sunset.jpg Binary files differnew file mode 100644 index 000000000..7d7307bed --- /dev/null +++ b/docs/content/content-management/image-processing/sunset.jpg diff --git a/docs/content/content-management/multilingual.md b/docs/content/content-management/multilingual.md index 31d409109..22271b4c8 100644 --- a/docs/content/content-management/multilingual.md +++ b/docs/content/content-management/multilingual.md @@ -17,7 +17,7 @@ aliases: [/content/multilingual/,/content-management/multilingual/,/tutorials/cr toc: true --- -You should define the available languages in a `Languages` section in your site configuration. +You should define the available languages in a `languages` section in your site configuration. ## Configure Languages @@ -30,22 +30,24 @@ copyright = "Everything is mine" [params.navigation] help = "Help" |