Merge commit '7d7771b673e5949f554515a2c236b23192c765c8'

This commit is contained in:
Bjørn Erik Pedersen
2020-09-07 21:37:51 +02:00
14 changed files with 226 additions and 94 deletions

View File

@@ -95,7 +95,7 @@ The features currently supported are:
* `link`
* `heading` {{< new-in "0.71.0" >}}
You can define [Output-Format-](/templates/output-formats) and [language-](/content-management/multilingual/)specific templates if needed.[^hooktemplate] Your `layouts` folder may look like this:
You can define [Output-Format-](/templates/output-formats) and [language-](/content-management/multilingual/)specific templates if needed. Your `layouts` folder may look like this:
```bash
layouts
@@ -194,5 +194,3 @@ The rendered html will be
```html
<h3 id="section-a">Section A <a href="#section-a"></a></h3>
```
[^hooktemplate]: It's currently only possible to have one set of render hook templates, e.g. not per `Type` or `Section`. We may consider that in a future version.

View File

@@ -58,6 +58,14 @@ brew install hugo
For more detailed explanations, read the installation guides that follow for installing on macOS and Windows.
### MacPorts (macOS)
If you are on macOS and using [MacPorts][macports], you can install Hugo with the following one-liner:
{{< code file="install-with-macports.sh" >}}
port install hugo
{{< /code >}}
### Homebrew (Linux)
If you are using [Homebrew][linuxbrew] on Linux, you can install Hugo with the following one-liner:
@@ -133,7 +141,7 @@ If you are a Windows user, substitute the `$HOME` environment variable above wit
There are three ways to install Hugo on your Mac
1. The [Homebrew][brew] `brew` utility
1. A package manager, like [Homebrew][brew] (`brew`) or [MacPorts][macports] (`port`)
2. Distribution (i.e., tarball)
3. Building from Source
@@ -143,7 +151,7 @@ There is no "best" way to install Hugo on your Mac. You should use the method th
There are pros and cons to each of the aforementioned methods:
1. **Homebrew.** Homebrew is the simplest method and will require the least amount of work to maintain. The drawbacks aren't severe. The default package will be for the most recent release, so it will not have bug fixes until the next release (i.e., unless you install it with the `--HEAD` option). Hugo `brew` releases may lag a few days behind because it has to be coordinated with another team. Nevertheless, `brew` is the recommended installation method if you want to work from a stable, widely used source. Brew works well and is easy to update.
1. **Package Manager.** Using a package manager is the simplest method and will require the least amount of work to maintain. The drawbacks aren't severe. The default package will be for the most recent release, so it will not have bug fixes until the next release (i.e., unless you install it with the `--HEAD` option in Homebrew). Releases may lag a few days behind because it has to be coordinated with another team. Nevertheless, this is the recommended installation method if you want to work from a stable, widely used source. Package managers work well and they are easy to update.
2. **Tarball.** Downloading and installing from the tarball is also easy, although it requires a few more command line skills than does Homebrew. Updates are easy as well: you just repeat the process with the new binary. This gives you the flexibility to have multiple versions on your computer. If you don't want to use `brew`, then the tarball/binary is a good choice.
@@ -261,7 +269,7 @@ Archive: hugo_X.Y_osx-64bit.tgz
Hugo Static Site Generator v0.13 BuildDate: 2015-02-22T04:02:30-06:00
```
You may need to add your bin directory to your `PATH` variable. The `which` command will check for us. If it can find `hugo`, it will print the full path to it. Otherwise, it will not print anything.
You may need to add your bin directory to your `PATH` environment variable. The `which` command will check for us. If it can find `hugo`, it will print the full path to it. Otherwise, it will not print anything.
```
# check if hugo is in the path
@@ -269,21 +277,37 @@ which hugo
/Users/USERNAME/bin/hugo
```
If `hugo` is not in your `PATH`, add it by updating your `~/.bash_profile` file. First, start up an editor:
If `hugo` is not in your `PATH`:
```
nano ~/.bash_profile
```
1. Determine your default shell (zsh or bash).
Add a line to update your `PATH` variable:
```
echo $SHELL
```
```
export PATH=$PATH:$HOME/bin
```
2. Edit your profile.
Then save the file by pressing Control-X, then Y to save the file and return to the prompt.
If your default shell is zsh:
Close the terminal and open a new terminal to pick up the changes to your profile. Verify your success by running the `which hugo` command again.
```
nano ~/.zprofile
```
If your default shell is bash:
```
nano ~/.bash_profile
```
3. Insert a line to add `$HOME/bin` to your existing `PATH`.
```
export PATH=$PATH:$HOME/bin
```
4. Save the file by pressing Control-X, then Y.
5. Close the terminal and open a new terminal to pick up the changes to your profile. Verify the change by running the `which hugo` command again.
You've successfully installed Hugo.
@@ -516,6 +540,7 @@ Upgrading Hugo is as easy as downloading and replacing the executable youve p
Now that you've installed Hugo, read the [Quick Start guide][quickstart] and explore the rest of the documentation. If you have questions, ask the Hugo community directly by visiting the [Hugo Discussion Forum][forum].
[brew]: https://brew.sh/
[macports]: https://www.macports.org/
[Chocolatey]: https://chocolatey.org/
[content]: /content-management/
[@dhersam]: https://github.com/dhersam

View File

@@ -29,11 +29,13 @@ For other approaches learning Hugo like book or a video tutorial refer to the [e
## Step 1: Install Hugo
{{% note %}}
`Homebrew`, a package manager for `macOS`, can be installed from [brew.sh](https://brew.sh/). See [install](/getting-started/installing) if you are running Windows etc.
`Homebrew` and `MacPorts`, package managers for `macOS`, can be installed from [brew.sh](https://brew.sh/) or [macports.org](https://www.macports.org/) respectively. See [install](/getting-started/installing) if you are running Windows etc.
{{% /note %}}
```bash
brew install hugo
# or
port install hugo
```
To verify your new install:
@@ -102,6 +104,10 @@ draft: true
```
{{% note %}}
Drafts do not get deployed; once you finish a post, update the header of the post to say `draft: false`. More info [here](/getting-started/usage/#draft-future-and-expired-content).
{{% /note %}}
## Step 5: Start the Hugo server
Now, start the Hugo server with [drafts](/getting-started/usage/#draft-future-and-expired-content) enabled:
@@ -171,6 +177,3 @@ hugo -D
Output will be in `./public/` directory by default (`-d`/`--destination` flag to change it, or set `publishdir` in the config file).
{{% note %}}
Drafts do not get deployed; once you finish a post, update the header of the post to say `draft: false`. More info [here](/getting-started/usage/#draft-future-and-expired-content).
{{% /note %}}