Installing hugo
-Report [Install Hugo] (https://gohugo.io/getting-started/installing/).
Since I am using ubuntu… simply…
sudo apt install hugo
This will make installation simple..
Create a site
$ hugo new site blog
Congratulations! Your new Hugo site is created in /home/gyuha/workspace/temp/blog.
Just a few more steps and you're ready to go:
1.Download a theme into the same-named folder.
Choose a theme from https://themes.gohugo.io/, or
create your own with the "hugo new theme <THEMENAME>" command.
2. Perhaps you want to add some content. You can add single files
with "hugo new <SECTIONNAME>/<FILENAME>.<FORMAT>".
3. Start the built-in live server via "hugo server".
Visit https://gohugo.io/ for quickstart guide and full documentation.
$ cd blog
Try the site
$ hugo server
ERROR 2018/11/07 00:33:28 port 1313 already in use, attempting to use an available port
| EN
+------------------+----+
Pages | 3
Paginator pages | 0
Non-page files | 0
Static files | 0
Processed images | 0
Aliases | 0
Sitemaps | One
Cleaned | 0
Total in 10 ms
Watching for changes in /home/gyuha/workspace/temp/blog/{content,data,layouts,static}
Watching for config changes in /home/gyuha/workspace/temp/blog/config.toml
Serving pages from memory
Running in Fast Render Mode. For full rebuilds on change: hugo server --disableFastRender
Web Server is available at http://localhost:1313/ (bind address 127.0.0.1)
Press Ctrl+C to stop
If I try to run http://localhost:1313 in a web browser, nothing comes up.
Install Theme
Let’s install the skins used on this site.
First, initialize it with git init
and receive the theme.
git init
cd themes
git submodule add https://github.com/halogenica/beautifulhugo.git beautifulhugo
cd ..
If you try `hugo server again’… nothing is still coming out.
This is because there is no setting data.
cp themes/beautifulhugo/exampleSite/config.toml.
hugo server -D
If you do this and run it as http://localhost:1313, you can see that the site appears normally.
Also, you must see the updated text by adding the -D
option.
Modify config.toml
to the form I want.
Add new post
hugo new post/2018-11-11-start-blog.md
If you add as above, a new post is added.
Post to GitHub
-Please refer to [Host on GitHub] (https://gohugo.io/hosting-and-deployment/hosting-on-github/).
Makefile
I’ve been bothered to hit the above process every time… I made it with a makefile…
HUGO = hugo
COMMIT_MESSAGE = "rebuilding site $(shell date +%Y-%m-%d)"
run:
$(HUGO) server -D
clone:
rm -rf public
git clone https://github.com/<USERNAME|ORGANIZATION>/<USERNAME|ORGANIZATION>.github.io.git
mv gyuha.github.io public
new:
$(HUGO) new post/$(shell date +%Y-%m-%d)-$(title).md
deploy:
echo "\033[0;32mDeploying updates to GitHub...\033[0m"
# Build the project.
$(HUGO) -D
cd ./public && git add. && git commit -m $(COMMIT_MESSAGE) && git push