mirror of
https://github.com/gohugoio/hugo.git
synced 2025-05-08 19:59:23 +03:00
Docs: Minor copyediting/proofreading
- Correct some typos - Add backticks and commas where necessary - Use fenced code blocks specifying "bash" as the language to avoid weird highlighting - Place commas outside of quotation marks surroundingn codes to avoid possible confusion - Suggest users to use the discussion forum rather than the mailing list
This commit is contained in:
parent
736dd4b521
commit
a6d3862b87
15 changed files with 83 additions and 75 deletions
|
@ -6,8 +6,8 @@ next = "/tutorials/mathjax"
|
|||
prev = "/community/contributing"
|
||||
title = "Creating a New Theme"
|
||||
weight = 10
|
||||
[[menu:main]]
|
||||
parent = "tutorials"
|
||||
[[menu.main]]
|
||||
parent = "tutorials"
|
||||
+++
|
||||
|
||||
## Introduction
|
||||
|
@ -81,7 +81,7 @@ Content is stored in text files that contain two sections. The first section is
|
|||
|
||||
#### Front Matter
|
||||
|
||||
The front matter is information about the content. Like the configuration file, it can be written in TOML, YAML, or JSON. Unlike the configuration file, Hugo doesn’t use the file’s extension to know the format. It looks for markers to signal the type. TOML is surrounded by “+++,” YAML by “---,” and JSON is enclosed in curly braces. I prefer to use TOML, so you’ll need to translate my examples if you prefer YAML or JSON.
|
||||
The front matter is information about the content. Like the configuration file, it can be written in TOML, YAML, or JSON. Unlike the configuration file, Hugo doesn’t use the file’s extension to know the format. It looks for markers to signal the type. TOML is surrounded by “`+++`”, YAML by “`---`”, and JSON is enclosed in curly braces. I prefer to use TOML, so you’ll need to translate my examples if you prefer YAML or JSON.
|
||||
|
||||
The information in the front matter is passed into the template before the content is rendered into HTML.
|
||||
|
||||
|
@ -140,7 +140,7 @@ The other directories (archetypes/, layouts/, and static/) are used when customi
|
|||
|
||||
### Generate the HTML For the New Site
|
||||
|
||||
Running the hugo command with no options will read all the available content and generate the HTML files. It will also copy all static files (that's everything that's not content). Since we have an empty site, it won't do much, but it will do it very quickly.
|
||||
Running the `hugo` command with no options will read all the available content and generate the HTML files. It will also copy all static files (that's everything that's not content). Since we have an empty site, it won't do much, but it will do it very quickly.
|
||||
|
||||
```
|
||||
$ hugo --verbose
|
||||
|
@ -157,7 +157,7 @@ in 2 ms
|
|||
$
|
||||
```
|
||||
|
||||
The "--verbose" flag gives extra information that will be helpful when we build the template. Every line of the output that starts with "INFO:" or "WARN:" is present because we used that flag. The lines that start with "WARN:" are warning messages. We'll go over them later.
|
||||
The "`--verbose`" flag gives extra information that will be helpful when we build the template. Every line of the output that starts with "INFO:" or "WARN:" is present because we used that flag. The lines that start with "WARN:" are warning messages. We'll go over them later.
|
||||
|
||||
We can verify that the command worked by looking at the directory again.
|
||||
|
||||
|
@ -422,7 +422,7 @@ Note: If you're building on an SSD, you should ignore this. Churning on a SSD ca
|
|||
|
||||
### Hugo's Watch Option
|
||||
|
||||
Hugo's "--watch" option will monitor the content/ and your theme directories for changes and rebuild the site automatically.
|
||||
Hugo's "`--watch`" option will monitor the content/ and your theme directories for changes and rebuild the site automatically.
|
||||
|
||||
### Live Reload
|
||||
|
||||
|
@ -529,7 +529,7 @@ $ cat public/index.html
|
|||
|
||||
#### Live Reload
|
||||
|
||||
Note: If you're running the server with the --watch option, you'll see different content in the file:
|
||||
Note: If you're running the server with the `--watch` option, you'll see different content in the file:
|
||||
|
||||
```
|
||||
$ cat public/index.html
|
||||
|
@ -544,7 +544,7 @@ $ cat public/index.html
|
|||
</html>
|
||||
```
|
||||
|
||||
When you use --watch, the Live Reload script is added by Hugo. Look for live reload in the documentation to see what it does and how to disable it.
|
||||
When you use `--watch`, the Live Reload script is added by Hugo. Look for live reload in the documentation to see what it does and how to disable it.
|
||||
|
||||
### Build a "Dynamic" Home Page
|
||||
|
||||
|
@ -1145,4 +1145,4 @@ Note that we removed the date logic from the default template and put it in the
|
|||
|
||||
### Don't Repeat Yourself
|
||||
|
||||
DRY is a good design goal and Hugo does a great job supporting it. Part of the art of a good template is knowing when to add a new template and when to update an existing one. While you're figuring that out, Accept that you'll be doing some refactoring. Hugo makes that easy and fast, so it's okay to delay splitting up a template.
|
||||
DRY is a good design goal and Hugo does a great job supporting it. Part of the art of a good template is knowing when to add a new template and when to update an existing one. While you're figuring that out, accept that you'll be doing some refactoring. Hugo makes that easy and fast, so it's okay to delay splitting up a template.
|
||||
|
|
|
@ -225,20 +225,20 @@ For more information about the deployment script, see this [README](https://gith
|
|||
|
||||
## Hosting Personal/Organization Pages
|
||||
|
||||
As mentionned [in this github's article](https://help.github.com/articles/user-organization-and-project-pages/), besides project pages, you may also want to host a user/organization page. Here are the key differences:
|
||||
As mentioned [in this GitHub's article](https://help.github.com/articles/user-organization-and-project-pages/), besides project pages, you may also want to host a user/organization page. Here are the key differences:
|
||||
|
||||
> - You must use the username.github.io naming scheme.
|
||||
> - Content from the master branch will be used to build and publish your GitHub Pages site.
|
||||
> - You must use the `username.github.io` naming scheme.
|
||||
> - Content from the `master` branch will be used to build and publish your GitHub Pages site.
|
||||
|
||||
It becomes much simpler in that case: we'll create two separated repos, one for Hugo's content, and a git submodule with the `public` folder's content in it.
|
||||
It becomes much simpler in that case: we'll create two separate repos, one for Hugo's content, and a git submodule with the `public` folder's content in it.
|
||||
|
||||
Step by step:
|
||||
|
||||
1. Create on github `<your-project>-hugo` repository (it will host hugo's content)
|
||||
2. Create on github `<username>.github.io` repository (it will host the `public` folder: the static website)
|
||||
1. Create on GitHub `<your-project>-hugo` repository (it will host Hugo's content)
|
||||
2. Create on GitHub `<username>.github.io` repository (it will host the `public` folder: the static website)
|
||||
2. `git clone <<your-project>-hugo-url> && cd <your-project>-hugo`
|
||||
3. Make your website work locally (`hugo serve --watch -t <yourtheme>`)
|
||||
4. Once you are happy with the results, `Ctrl+c` (kill server) and `rm -rf public` (don't worry it can always be regenerated with `hugo -t <yourtheme>`)
|
||||
4. Once you are happy with the results, `Ctrl+c` (kill server) and `rm -rf public` (don't worry, it can always be regenerated with `hugo -t <yourtheme>`)
|
||||
5. `git submodule add git@github.com:<username>/<username>.github.io.git public`
|
||||
6. Almost done: add a `deploy.sh` script to help you (and make it executable: `chmod +x deploy.sh`):
|
||||
|
||||
|
@ -268,10 +268,10 @@ git push origin master
|
|||
# Come Back
|
||||
cd ..
|
||||
```
|
||||
7. `./deploy.sh "Your optional commit message"` to send changes to `<username>.github.io` (carefull, you may also want to commit changes on the `<your-project>-hugo` repo).
|
||||
7. `./deploy.sh "Your optional commit message"` to send changes to `<username>.github.io` (careful, you may also want to commit changes on the `<your-project>-hugo` repo).
|
||||
|
||||
That's it, your personal page is running at [http://username.github.io](http://username.github.io) (after up to 10 minutes delay).
|
||||
That's it! Your personal page is running at [http://username.github.io](http://username.github.io) (after up to 10 minutes delay).
|
||||
|
||||
## Conclusion
|
||||
|
||||
Hopefully this tutorial helped you get your website off its feet and out into the open! If you have any further questions feel free to contact the community through the [mailing lists](/community/mailing-list).
|
||||
Hopefully this tutorial helped you get your website off its feet and out into the open! If you have any further questions, feel free to contact the community through the [discussion forum](/community/mailing-list).
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue