Previous Post | Top | Next Post |
TOC
Costomization wishlist
Let’s customize web site contents.
- I want to have 2 separate directories for English and Japanese contents.
- Main menu should have link to the list of contents dedicated for English and Japanese contents
- The list of contents needs to be customized.
The following pages gave me good starting points.
- https://www.jakewiesler.com/blog/hugo-directory-structure/
- https://sourceforge.net/p/hugo-generator/wiki/markdown_syntax/
Customization example
Here are what I did:
- Since I don’t use
content/_index.Rmarkdown
, I erased it. - In order to save typing, I renamed
content/_index.markdown
tocontent/_index.md
. Of course, I cleaned out most of the contents. - Since upstream had
content/note
andcontent/post
, I renamed them tocontent/en
andcontent/jp
. - The menu entries for
English
andJapanese
are added by editingconfig.toml
. content/en/_index.md
andcontent/jp/_index.md
are added to customize the list of contents.
Then create a github repository osamuaoki-hugo
via github GUI and commit this
source for hugo.
$ git add -A .
$ git commit -m "updated webpage source"
$ git remote add origin git@github.com:osamuaoki/osamuaoki-hugo.git
$ git push -u origin master
See published source of this site at https://github.com/osamuaoki/osamuaoki-hugo
Publishing HTML pages
At /path/to/<webbuildtree>
, execute hugo
to build HTML files under
/path/to/<webbuildtree>/publish
directory.
Then create a github repository osamuaoki.github.io
via github GUI and commit
this generated HTML files.
$ hugo
$ cd public
$ git init
$ git add .
$ git commit -m "built webpages"
$ git remote add origin git@github.com:osamuaoki/osamuaoki.github.io.git
$ git push -u origin master
This publishes web page at https://osamuaoki.github.io/
Let’s use git submodule
to manage these 2 repositories.
$ cd ..
$ rm -rf public
$ git submodule add git@github.com:osamuaoki/osamuaoki.github.io.git public
$ git add .
$ git commit -m "add submodule"
Here, publication of github pages is realized by committing static HTML pages to a certain branch of a certain github repository to enable github pages.
repository | branch | URL used to publish web pages |
---|---|---|
<username>.github.io |
master |
https://<username>.github.io |
<project> |
gh-pages |
https://<username>.github.io/<project> |
For more, follow Host on GitHub
Updating webpages
$ cd /path/to/<webbuildtree>/content
... hack source
$ cd /path/to/<webbuildtree>
$ git add -A .
$ git commit -m "updated source"
$ hugo
$ cd publish
$ git add -A .
$ git commit -m "updated webpages"
$ cd ..
$ git commit -a -m "updated submodule for webpages"
Date
Normally, hugo doesn’t publish future date unless -F
is specified.
So please consider to include date:
to include full date --iso=sec
output
as follows.
- Header of this page:
title: Initial setup for hugo (2)
date: 2019-02-09T11:15:56+09:00
categories:
- web
- english
tags:
- hugo
slug: initial-setup02
- Header to publish anytime after the start of the day of JST.
date: 2019-02-09T00:00:00+09:00
- Header to publish anytime after the end of the day of JST.
date: 2019-02-09T23:59:59+09:00
If time zone is omitted, hugo seems to use UT.
Draft
Add following to the header of the source.
date: 2999-12-31
draft: true
Check the resulting page with hugo -F -D server
to include darft and future
dated page.
salsa (debian) page
TODO
For more, follow
Host on GitLab
while using pages.debian.net
instead of gitlab.io
and Web page
hosting.
Previous Post | Top | Next Post |