From: Bjørn Erik Pedersen Date: Tue, 8 Jun 2021 16:47:53 +0000 (+0200) Subject: Merge commit '32ba623541d74ee0b7ae4efb1b8326dc49af28b8' X-Git-Tag: v0.84.0~21 X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=162f41d0efdd4a5e12e489cf8ecf8490b45884da;p=brevno-suite%2Fhugo Merge commit '32ba623541d74ee0b7ae4efb1b8326dc49af28b8' --- 162f41d0efdd4a5e12e489cf8ecf8490b45884da diff --cc docs/.gitignore index b203a37c,00000000..6f4431f4 mode 100644,000000..100644 --- a/docs/.gitignore +++ b/docs/.gitignore @@@ -1,5 -1,0 +1,6 @@@ +/.idea +/public ++node_modules +nohup.out +.DS_Store +trace.out diff --cc docs/content/en/content-management/image-processing/index.md index 9eefa1f7,00000000..40af0d6a mode 100644,000000..100644 --- a/docs/content/en/content-management/image-processing/index.md +++ b/docs/content/en/content-management/image-processing/index.md @@@ -1,344 -1,0 +1,348 @@@ +--- +title: "Image Processing" +description: "Image Page resources can be resized and cropped." +date: 2018-01-24T13:10:00-05:00 +linktitle: "Image Processing" +categories: ["content management"] +keywords: [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 do not work on images inside your `/static` folder. + +To print all images paths in a [Page Bundle]({{< relref "/content-management/organization#page-bundles" >}}): + +```go-html-template +{{ with .Resources.ByType "image" }} +{{ range . }} +{{ .RelPermalink }} +{{ end }} +{{ end }} + +``` + +## The Image Resource + +The `image` resource can also be retrieved from a [global resource]({{< relref "/hugo-pipes/introduction#from-file-to-resource" >}}) + +```go-html-template +{{- $image := resources.Get "images/logo.jpg" -}} +``` + +## Image Processing Methods + +The `image` resource implements the `Resize`, `Fit`, `Fill`, and `Filter` methods, each returning a transformed image using the specified dimensions and processing options. + +{{% note %}} +Metadata (EXIF, IPTC, XMP, etc.) is not preserved during image transformation. Use the [`Exif`](#exif) method with the _original_ image to extract EXIF metadata from JPEG or TIFF images. +{{% /note %}} + +### 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" }} +``` + +### Filter + +Apply one or more filters to your image. See [Image Filters](/functions/images/#image-filters) for a full list. + +```go-html-template +{{ $img = $img.Filter (images.GaussianBlur 6) (images.Pixelate 8) }} +``` + +The above can also be written in a more functional style using pipes: + +```go-html-template +{{ $img = $img | images.Filter (images.GaussianBlur 6) (images.Pixelate 8) }} +``` + +The filters will be applied in the given order. + +Sometimes it can be useful to create the filter chain once and then reuse it: + +```go-html-template +{{ $filters := slice (images.GaussianBlur 6) (images.Pixelate 8) }} +{{ $img1 = $img1.Filter $filters }} +{{ $img2 = $img2.Filter $filters }} +``` + +### Exif + +Provides an [Exif](https://en.wikipedia.org/wiki/Exif) object with metadata about the image. + +Note that this is only supported for JPEG and TIFF images, so it's recommended to wrap the access with a `with`, e.g.: + +```go-html-template +{{ with $img.Exif }} +Date: {{ .Date }} +Lat/Long: {{ .Lat}}/{{ .Long }} +Tags: +{{ range $k, $v := .Tags }} +TAG: {{ $k }}: {{ $v }} +{{ end }} +{{ end }} +``` + +Or individually access EXIF data with dot access, e.g.: + +```go-html-template +{{ with $src.Exif }} + +{{ end }} +``` + +Some fields may need to be formatted with [`lang.NumFmt`]({{< relref "functions/numfmt" >}}) function to prevent display like `Aperture: 2.278934289` instead of `Aperture: 2.28`. + +#### Exif fields + +Date +: "photo taken" date/time + +Lat +: "photo taken where", GPS latitude + +Long +: "photo taken where", GPS longitude + +See [Image Processing Config](#image-processing-config) for how to configure what gets included in Exif. + +## Image Processing Options + +In addition to the dimensions (e.g. `600x400`), Hugo supports a set of additional image options. + +### Background Color + +The background color to fill into the transparency layer. This is mostly useful when converting to a format that does not support transparency, e.g. `JPEG`. + +You can set the background color to use with a 3 or 6 digit hex code starting with `#`. + +```go +{{ $image.Resize "600x jpg #b31280" }} +``` + +For color codes, see https://www.google.com/search?q=color+picker + +**Note** that you also set a default background color to use, see [Image Processing Config](#image-processing-config). + - ### JPEG and Webp Quality ++### JPEG and WebP Quality + - Only relevant for JPEG and Webp images, values 1 to 100 inclusive, higher is better. Default is 75. ++Only relevant for JPEG and WebP images, values 1 to 100 inclusive, higher is better. Default is 75. + +```go +{{ $image.Resize "600x q50" }} +``` + - {{< new-in "0.83.0" >}} Webp support was added in Hugo 0.83.0. ++{{< new-in "0.83.0" >}} WebP support was added in Hugo 0.83.0. + +### Hint + + {{< new-in "0.83.0" >}} + - Hint about what type of image this is. Currently only used when encoding to Webp. ++ {{< new-in "0.83.0" >}} ++ ++Hint about what type of image this is. Currently only used when encoding to WebP. + +Default value is `photo`. + +Valid values are `picture`, `photo`, `drawing`, `icon`, or `text`. + +```go +{{ $image.Resize "600x webp drawing" }} +``` + +### 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 values are `Smart`, `Center`, `TopLeft`, `Top`, `TopRight`, `Left`, `Right`, `BottomLeft`, `Bottom`, `BottomRight`. + +Default value is `Smart`, which uses [Smartcrop](https://github.com/muesli/smartcrop) to determine the best crop. + +```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" }} +``` + +### Target Format + +By default the images is encoded in the source format, but you can set the target format as an option. + - Valid values are `jpg`, `png`, `tif`, `bmp`, and `gif`. ++Valid values are `jpg`, `png`, `tif`, `bmp`, `gif` and `webp`. + +```go +{{ $image.Resize "600x jpg" }} +``` + ++{{< new-in "0.83.0" >}} WebP support was added in Hugo 0.83.0. ++ +## 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 +{{}} +``` + +{{% note %}} +**Tip:** Note the self-closing shortcode syntax above. The `imgproc` shortcode can be called both with and without **inner content**. +{{% /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" + - # Default JPEG or WEBP quality setting. Default is 75. ++# Default JPEG or WebP quality setting. Default is 75. +quality = 75 + - # Default hint about what type of image. Currently only used for Webp encoding. ++# Default hint about what type of image. Currently only used for WebP encoding. +# Default is "photo". +# Valid values are "picture", "photo", "drawing", "icon", or "text". +hint = "photo" + +# 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" + +# Default background color. +# Hugo will preserve transparency for target formats that supports it, +# but will fall back to this color for JPEG. +# Expects a standard HEX color string with 3 or 6 digits. +# See https://www.google.com/search?q=color+picker +bgColor = "#ffffff" + +[imaging.exif] + # Regexp matching the fields you want to Exclude from the (massive) set of Exif info +# available. As we cache this info to disk, this is for performance and +# disk space reasons more than anything. +# If you want it all, put ".*" in this config setting. +# Note that if neither this or ExcludeFields is set, Hugo will return a small +# default set. +includeFields = "" + +# Regexp matching the Exif fields you want to exclude. This may be easier to use +# than IncludeFields above, depending on what you want. +excludeFields = "" + +# Hugo extracts the "photo taken" date/time into .Date by default. +# Set this to true to turn it off. +disableDate = false + +# Hugo extracts the "photo taken where" (GPS latitude and longitude) into +# .Long and .Lat. Set this to true to turn it off. +disableLatLong = false + + +``` + +## Smart Cropping of Images + +By default, Hugo will use [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 library 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 `/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 %}} diff --cc docs/content/en/functions/scratch.md index f42b0ad5,00000000..5b155aff mode 100644,000000..100644 --- a/docs/content/en/functions/scratch.md +++ b/docs/content/en/functions/scratch.md @@@ -1,141 -1,0 +1,155 @@@ +--- +title: .Scratch - description: Acts as a "scratchpad" to allow for writable page- or shortcode-scoped variables. ++description: Acts as a "scratchpad" to store and manipulate data. +godocref: +date: 2017-02-01 +publishdate: 2017-02-01 +lastmod: 2017-02-01 +keywords: [iteration] +categories: [functions] +menu: + docs: + parent: "functions" +toc: +signature: [] +workson: [] +hugoversion: +relatedfuncs: [] +deprecated: false +draft: false +aliases: [/extras/scratch/,/doc/scratch/] +--- + - In most cases you can do okay without `Scratch`, but due to scoping issues, there are many use cases that aren't solvable in Go Templates without `Scratch`'s help. - - `.Scratch` is available as methods on `Page` and `Shortcode`. Since Hugo 0.43 you can also create a locally scoped `Scratch` using the template func `newScratch`. - ++Scratch is a Hugo feature designed to conveniently manipulate data in a Go Template world. It is either a Page or Shortcode method for which the resulting data will be attached to the given context, or it can live as a unique instance stored in a variable. + +{{% note %}} - See [this Go issue](https://github.com/golang/go/issues/10608) for the main motivation behind Scratch. ++Note that Scratch was initially created as a workaround for a [Go template scoping limitation](https://github.com/golang/go/issues/10608) that affected Hugo versions prior to 0.48. For a detailed analysis of `.Scratch` and contextual use cases, see [this blog post](https://regisphilibert.com/blog/2017/04/hugo-scratch-explained-variable/). +{{% /note %}} + - {{% note %}} - For a detailed analysis of `.Scratch` and in context use cases, see this [post](https://regisphilibert.com/blog/2017/04/hugo-scratch-explained-variable/). - {{% /note %}} ++### Contexted `.Scratch` vs. local `newScratch` ++ ++Since Hugo 0.43, there are two different ways of using Scratch: ++ ++#### The Page's `.Scratch` ++ ++`.Scratch` is available as a Page method or a Shortcode method and attaches the "scratched" data to the given page. Either a Page or a Shortcode context is required to use `.Scratch`. ++ ++```go-html-template ++{{ .Scratch.Set "greeting" "bonjour" }} ++{{ range .Pages }} ++ {{ .Scratch.Set "greeting" (print "bonjour" .Title) }} ++{{ end }} ++``` + - ## Get a Scratch ++#### The local `newScratch` + - From Hugo `0.43` you can also create a locally scoped `Scratch` by calling `newScratch`: ++{{< new-in "0.43.0" >}} A Scratch instance can also be assigned to any variable using the `newScratch` function. In this case, no Page or Shortcode context is required and the scope of the scratch is only local. The methods detailed below are available from the variable the Scratch instance was assigned to. + +```go-html-template - $scratch := newScratch - $scratch.Set "greeting" "Hello" ++{{ $data := newScratch }} ++{{ $data.Set "greeting" "hola" }} +``` + - A `Scratch` is also added to both `Page` and `Shortcode`. `Scratch` has the following methods: ++### Methods ++ ++A Scratch has the following methods: ++ ++{{% note %}} ++Note that the following examples assume a [local Scratch instance](#the-local-newscratch) has been stored in `$scratch`. ++{{% /note %}} + +#### .Set + - Set the given value to a given key ++Set the value of a given key. + +```go-html-template - {{ .Scratch.Set "greeting" "Hello" }} ++{{ $scratch.Set "greeting" "Hello" }} +``` ++ +#### .Get - Get the value of a given key ++ ++Get the value of a given key. + +```go-html-template - {{ .Scratch.Set "greeting" "Hello" }} ++{{ $scratch.Set "greeting" "Hello" }} +---- - {{ .Scratch.Get "greeting" }} > Hello ++{{ $scratch.Get "greeting" }} > Hello +``` + +#### .Add - Will add a given value to existing value of the given key. ++ ++Add a given value to existing value(s) of the given key. + +For single values, `Add` accepts values that support Go's `+` operator. If the first `Add` for a key is an array or slice, the following adds will be appended to that list. + +```go-html-template - {{ .Scratch.Add "greetings" "Hello" }} - {{ .Scratch.Add "greetings" "Welcome" }} ++{{ $scratch.Add "greetings" "Hello" }} ++{{ $scratch.Add "greetings" "Welcome" }} +---- - {{ .Scratch.Get "greetings" }} > HelloWelcome ++{{ $scratch.Get "greetings" }} > HelloWelcome +``` + +```go-html-template - {{ .Scratch.Add "total" 3 }} - {{ .Scratch.Add "total" 7 }} ++{{ $scratch.Add "total" 3 }} ++{{ $scratch.Add "total" 7 }} +---- - {{ .Scratch.Get "total" }} > 10 ++{{ $scratch.Get "total" }} > 10 +``` + - +```go-html-template - {{ .Scratch.Add "greetings" (slice "Hello") }} - {{ .Scratch.Add "greetings" (slice "Welcome" "Cheers") }} ++{{ $scratch.Add "greetings" (slice "Hello") }} ++{{ $scratch.Add "greetings" (slice "Welcome" "Cheers") }} +---- - {{ .Scratch.Get "greetings" }} > []interface {}{"Hello", "Welcome", "Cheers"} ++{{ $scratch.Get "greetings" }} > []interface {}{"Hello", "Welcome", "Cheers"} +``` + +#### .SetInMap - Takes a `key`, `mapKey` and `value` and add a map of `mapKey` and `value` to the given `key`. ++ ++Takes a `key`, `mapKey` and `value` and adds a map of `mapKey` and `value` to the given `key`. + +```go-html-template - {{ .Scratch.SetInMap "greetings" "english" "Hello" }} - {{ .Scratch.SetInMap "greetings" "french" "Bonjour" }} ++{{ $scratch.SetInMap "greetings" "english" "Hello" }} ++{{ $scratch.SetInMap "greetings" "french" "Bonjour" }} +---- - {{ .Scratch.Get "greetings" }} > map[french:Bonjour english:Hello] ++{{ $scratch.Get "greetings" }} > map[french:Bonjour english:Hello] +``` + +#### .DeleteInMap +Takes a `key` and `mapKey` and removes the map of `mapKey` from the given `key`. + +```go-html-template +{{ .Scratch.SetInMap "greetings" "english" "Hello" }} +{{ .Scratch.SetInMap "greetings" "french" "Bonjour" }} +---- +{{ .Scratch.DeleteInMap "greetings" "english" }} +---- +{{ .Scratch.Get "greetings" }} > map[french:Bonjour] +``` + +#### .GetSortedMapValues - Returns array of values from `key` sorted by `mapKey` ++ ++Return an array of values from `key` sorted by `mapKey`. + +```go-html-template - {{ .Scratch.SetInMap "greetings" "english" "Hello" }} - {{ .Scratch.SetInMap "greetings" "french" "Bonjour" }} ++{{ $scratch.SetInMap "greetings" "english" "Hello" }} ++{{ $scratch.SetInMap "greetings" "french" "Bonjour" }} +---- - {{ .Scratch.GetSortedMapValues "greetings" }} > [Hello Bonjour] ++{{ $scratch.GetSortedMapValues "greetings" }} > [Hello Bonjour] +``` ++ +#### .Delete - Removes the given key ++ ++{{< new-in "0.38.0" >}} Remove the given key. + +```go-html-template - {{ .Scratch.Delete "greetings" }} ++{{ $scratch.Set "greeting" "Hello" }} ++---- ++{{ $scratch.Delete "greeting" }} +``` + +#### .Values + - `Values` returns the raw backing map. Note that you should just use this method on the locally scoped `Scratch` instances you obtain via `newScratch`, not - `.Page.Scratch` etc., as that will lead to concurrency issues. - - ## Scope - The scope of the backing data is global for the given `Page` or `Shortcode`, and spans partial and shortcode includes. - - Note that `.Scratch` from a shortcode will return the shortcode's `Scratch`, which in most cases is what you want. If you want to store it in the page scoped Scratch, then use `.Page.Scratch`. - - ++Return the raw backing map. Note that you should only use this method on the locally scoped Scratch instances you obtain via [`newScratch`](#the-local-newscratch), not `.Page.Scratch` etc., as that will lead to concurrency issues. + + +[pagevars]: /variables/page/ diff --cc docs/content/en/getting-started/usage.md index 2b41ecb4,00000000..32c27027 mode 100644,000000..100644 --- a/docs/content/en/getting-started/usage.md +++ b/docs/content/en/getting-started/usage.md @@@ -1,208 -1,0 +1,213 @@@ +--- +title: Basic Usage +linktitle: Basic Usage +description: Hugo's CLI is fully featured but simple to use, even for those who have very limited experience working from the command line. +date: 2017-02-01 +publishdate: 2017-02-01 +lastmod: 2017-02-01 +categories: [getting started] +keywords: [usage,livereload,command line,flags] +menu: + docs: + parent: "getting-started" + weight: 40 +weight: 40 +sections_weight: 40 +draft: false +aliases: [/overview/usage/,/extras/livereload/,/doc/usage/,/usage/] +toc: true +--- + +The following is a description of the most common commands you will use while developing your Hugo project. See the [Command Line Reference][commands] for a comprehensive view of Hugo's CLI. + +## Test Installation + +Once you have [installed Hugo][install], make sure it is in your `PATH`. You can test that Hugo has been installed correctly via the `help` command: + +``` +hugo help +``` + +The output you see in your console should be similar to the following: + +``` +hugo is the main command, used to build your Hugo site. + +Hugo is a Fast and Flexible Static Site Generator +built with love by spf13 and friends in Go. + +Complete documentation is available at https://gohugo.io/. + +Usage: + hugo [flags] + hugo [command] + +Available Commands: + check Contains some verification checks + config Print the site configuration + convert Convert your content to different formats + env Print Hugo version and environment info + gen A collection of several useful generators. + help Help about any command + import Import your site from others. + list Listing out various types of content + new Create new content for your site + server A high performance webserver + version Print the version number of Hugo + +Flags: + -b, --baseURL string hostname (and path) to the root, e.g. https://spf13.com/ + -D, --buildDrafts include content marked as draft + -E, --buildExpired include expired content + -F, --buildFuture include content with publishdate in the future + --cacheDir string filesystem path to cache directory. Defaults: $TMPDIR/hugo_cache/ + --cleanDestinationDir remove files from destination not found in static directories + --config string config file (default is path/config.yaml|json|toml) + --configDir string config dir (default "config") + -c, --contentDir string filesystem path to content directory + --debug debug output + -d, --destination string filesystem path to write files to + --disableKinds strings disable different kind of pages (home, RSS etc.) + --enableGitInfo add Git revision, date and author info to the pages + -e, --environment string build environment + --forceSyncStatic copy all files when static is changed. + --gc enable to run some cleanup tasks (remove unused cache files) after the build + -h, --help help for hugo + --i18n-warnings print missing translations + --ignoreCache ignores the cache directory + -l, --layoutDir string filesystem path to layout directory + --log enable Logging + --logFile string log File path (if set, logging enabled automatically) + --minify minify any supported output format (HTML, XML etc.) + --noChmod don't sync permission mode of files + --noTimes don't sync modification time of files + --path-warnings print warnings on duplicate target paths etc. + --quiet build in quiet mode + --renderToMemory render to memory (only useful for benchmark testing) + -s, --source string filesystem path to read files relative from + --templateMetrics display metrics about template executions + --templateMetricsHints calculate some improvement hints when combined with --templateMetrics + -t, --theme strings themes to use (located in /themes/THEMENAME/) + --themesDir string filesystem path to themes directory + --trace file write trace to file (not useful in general) + -v, --verbose verbose output + --verboseLog verbose logging + -w, --watch watch filesystem for changes and recreate as needed + +Use "hugo [command] --help" for more information about a command. +``` + +## The `hugo` Command + +The most common usage is probably to run `hugo` with your current directory being the input directory. + +This generates your website to the `public/` directory by default, although you can customize the output directory in your [site configuration][config] by changing the `publishDir` field. + +The command `hugo` renders your site into `public/` dir and is ready to be deployed to your web server: + +``` +hugo +0 draft content +0 future content +99 pages created +0 paginator pages created +16 tags created +0 groups created +in 90 ms +``` + +## Draft, Future, and Expired Content + +Hugo allows you to set `draft`, `publishdate`, and even `expirydate` in your content's [front matter][]. By default, Hugo will not publish: + +1. Content with a future `publishdate` value +2. Content with `draft: true` status +3. Content with a past `expirydate` value + +All three of these can be overridden during both local development *and* deployment by adding the following flags to `hugo` and `hugo server`, respectively, or by changing the boolean values assigned to the fields of the same name (without `--`) in your [configuration][config]: + +1. `--buildFuture` +2. `--buildDrafts` +3. `--buildExpired` + +## LiveReload + +Hugo comes with [LiveReload](https://github.com/livereload/livereload-js) built in. There are no additional packages to install. A common way to use Hugo while developing a site is to have Hugo run a server with the `hugo server` command and watch for changes: + +``` +hugo server +0 draft content +0 future content +99 pages created +0 paginator pages created +16 tags created +0 groups created +in 120 ms +Watching for changes in /Users/yourname/sites/yourhugosite/{data,content,layouts,static} +Serving pages from /Users/yourname/sites/yourhugosite/public +Web Server is available at http://localhost:1313/ +Press Ctrl+C to stop +``` + +This will run a fully functioning web server while simultaneously watching your file system for additions, deletions, or changes within the following areas of your [project organization][dirs]: + +* `/static/*` +* `/content/*` +* `/data/*` +* `/i18n/*` +* `/layouts/*` +* `/themes//*` +* `config` + +Whenever you make changes, Hugo will simultaneously rebuild the site and continue to serve content. As soon as the build is finished, LiveReload tells the browser to silently reload the page. + +Most Hugo builds are so fast that you may not notice the change unless looking directly at the site in your browser. This means that keeping the site open on a second monitor (or another half of your current monitor) allows you to see the most up-to-date version of your website without the need to leave your text editor. + +{{% note "Closing `` Tag"%}} +Hugo injects the LiveReload `