mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-21 21:35:28 +02:00
Merge commit '26f1458a2df6b55eee3a5de46f5fec23a43a7c7d'
This commit is contained in:
@@ -84,14 +84,14 @@ Note that this is only supported with the [Goldmark](#goldmark) renderer.
|
||||
|
||||
These Render Hooks allow custom templates to render links and images from markdown.
|
||||
|
||||
You can do this by creating templates with base names `render-link` and/or `render-image` inside `layouts/_default`.
|
||||
You can do this by creating templates with base names `render-link` and/or `render-image` inside `layouts/_default/_markup`.
|
||||
|
||||
You can define [Output Format](/templates/output-formats) and [language](/content-management/multilingual/) nspecific 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.[^hooktemplate] Your `layouts` folder may look like this:
|
||||
|
||||
```bash
|
||||
layouts
|
||||
└── _default
|
||||
└── markup
|
||||
└── _markup
|
||||
├── render-image.html
|
||||
├── render-image.rss.xml
|
||||
└── render-link.html
|
||||
@@ -122,7 +122,7 @@ Text
|
||||
PlainText
|
||||
: The plain variant of the above.
|
||||
|
||||
A Markdown example for a inline-style link with title:
|
||||
A Markdown example for an inline-style link with title:
|
||||
|
||||
```md
|
||||
[Text](https://www.gohugo.io "Title")
|
||||
@@ -130,11 +130,9 @@ A Markdown example for a inline-style link with title:
|
||||
|
||||
A very simple template example given the above:
|
||||
|
||||
{{< code file="layouts/_default/render-link.html" >}}
|
||||
<a href="{{ .Destination | safeURL }}"{{ with .Title}}title="{{ . }}"{{ end }}>{{ .Text }}{{ with .Page }} (in page {{ .Title }}){{ end }}"</a>
|
||||
{{< code file="layouts/_default/_markup/render-link.html" >}}
|
||||
<a href="{{ .Destination | safeURL }}"{{ with .Title}} title="{{ . }}"{{ end }}{{ if strings.HasPrefix .Destination "http" }} target="_blank"{{ end }}>{{ .Text }}</a>
|
||||
{{< /code >}}
|
||||
|
||||
(look in the page bundle, inside `/assets` etc.) and [transform](/content-management/image-processing) images.
|
||||
|
||||
[^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.
|
||||
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 223 KiB After Width: | Height: | Size: 65 KiB |
@@ -461,7 +461,7 @@ Hugo installed via Snap can write only inside the user’s `$HOME` directory---a
|
||||
|
||||
sudo apt-get install hugo
|
||||
|
||||
This installs the "extended" Sass/SCSS version.
|
||||
What this installs depends on your Debian/Ubuntu version. On Ubuntu bionic (18.04), this installs the non-extended version without Sass/SCSS support. On Ubuntu disco (19.04), this installs the extended version with Sass/SCSS support.
|
||||
|
||||
This option is not recommended because the Hugo in Linux package managers for Debian and Ubuntu is usually a few versions behind as described [here](https://github.com/gcushen/hugo-academic/issues/703)
|
||||
|
||||
|
@@ -26,8 +26,6 @@ It is recommended to have [Git installed](https://git-scm.com/downloads) to run
|
||||
For other approaches learning Hugo like book or a video tutorial refer to the [external learning resources](/getting-started/external-learning-resources/) page.
|
||||
{{% /note %}}
|
||||
|
||||
|
||||
|
||||
## Step 1: Install Hugo
|
||||
|
||||
{{% note %}}
|
||||
@@ -44,10 +42,8 @@ To verify your new install:
|
||||
hugo version
|
||||
```
|
||||
|
||||
|
||||
{{< asciicast ItACREbFgvJ0HjnSNeTknxWy9 >}}
|
||||
|
||||
|
||||
## Step 2: Create a New Site
|
||||
|
||||
```bash
|
||||
@@ -58,34 +54,33 @@ The above will create a new Hugo site in a folder named `quickstart`.
|
||||
|
||||
{{< asciicast 3mf1JGaN0AX0Z7j5kLGl3hSh8 >}}
|
||||
|
||||
|
||||
## Step 3: Add a Theme
|
||||
|
||||
See [themes.gohugo.io](https://themes.gohugo.io/) for a list of themes to consider. This quickstart uses the beautiful [Ananke theme](https://themes.gohugo.io/gohugo-theme-ananke/).
|
||||
|
||||
First, download the theme from Github and add it to your site's `theme` directory:
|
||||
|
||||
```bash
|
||||
cd quickstart
|
||||
|
||||
# Download the theme
|
||||
git init
|
||||
git submodule add https://github.com/budparr/gohugo-theme-ananke.git themes/ananke
|
||||
# Note for non-git users:
|
||||
# - If you do not have git installed, you can download the archive of the latest
|
||||
# version of this theme from:
|
||||
# https://github.com/budparr/gohugo-theme-ananke/archive/master.zip
|
||||
# - Extract that .zip file to get a "gohugo-theme-ananke-master" directory.
|
||||
# - Rename that directory to "ananke", and move it into the "themes/" directory.
|
||||
# End of note for non-git users.
|
||||
```
|
||||
|
||||
# Edit your config.toml configuration file
|
||||
# and add the Ananke theme.
|
||||
*Note for non-git users:*
|
||||
- If you do not have git installed, you can download the archive of the latest
|
||||
version of this theme from:
|
||||
https://github.com/budparr/gohugo-theme-ananke/archive/master.zip
|
||||
- Extract that .zip file to get a "gohugo-theme-ananke-master" directory.
|
||||
- Rename that directory to "ananke", and move it into the "themes/" directory.
|
||||
|
||||
Then, add the theme to the site configuration:
|
||||
|
||||
```bash
|
||||
echo 'theme = "ananke"' >> config.toml
|
||||
```
|
||||
|
||||
|
||||
{{< asciicast 7naKerRYUGVPj8kiDmdh5k5h9 >}}
|
||||
|
||||
|
||||
## Step 4: Add Some Content
|
||||
|
||||
You can manually create content files (for example as `content/<CATEGORY>/<FILE>.<FORMAT>`) and provide metadata in them, however you can use the `new` command to do few things for you (like add title and date):
|
||||
@@ -107,15 +102,12 @@ draft: true
|
||||
|
||||
```
|
||||
|
||||
|
||||
## Step 5: Start the Hugo server
|
||||
|
||||
Now, start the Hugo server with [drafts](/getting-started/usage/#draft-future-and-expired-content) enabled:
|
||||
|
||||
{{< asciicast BvJBsF6egk9c163bMsObhuNXj >}}
|
||||
|
||||
|
||||
|
||||
```
|
||||
▶ hugo server -D
|
||||
|
||||
@@ -140,12 +132,10 @@ Web Server is available at http://localhost:1313/ (bind address 127.0.0.1)
|
||||
Press Ctrl+C to stop
|
||||
```
|
||||
|
||||
|
||||
**Navigate to your new site at [http://localhost:1313/](http://localhost:1313/).**
|
||||
|
||||
Feel free to edit or add new content and simply refresh in browser to see changes quickly (You might need to force refresh in webbrowser, something like Ctrl-R usually works).
|
||||
|
||||
|
||||
## Step 6: Customize the Theme
|
||||
|
||||
Your new site already looks great, but you will want to tweak it a little before you release it to the public.
|
||||
@@ -167,12 +157,10 @@ Replace the `title` above with something more personal. Also, if you already hav
|
||||
**Tip:** Make the changes to the site configuration or any other file in your site while the Hugo server is running, and you will see the changes in the browser right away, though you may need to [clear your cache](https://kb.iu.edu/d/ahic).
|
||||
{{% /note %}}
|
||||
|
||||
|
||||
For theme specific configuration options, see the [theme site](https://github.com/budparr/gohugo-theme-ananke).
|
||||
|
||||
**For further theme customization, see [Customize a Theme](/themes/customizing/).**
|
||||
|
||||
|
||||
### Step 7: Build static pages
|
||||
|
||||
It is simple. Just call:
|
||||
|
Reference in New Issue
Block a user