このサイトを作った時のメモ

投稿テストも兼ねて

summaryのQiita見たら大体できるけど、作りながらメモしてたのをそのまま載せる。 結局academicというテーマ?を使っているので、6.からが実質的な作業。5.までは結局無意味

  1. 参考にした
  1. Hugoをインストール

    brew install hugo
    

    ==> brew cleanup has not been run in 30 days, running now… Removing: /Users/ME/Library/Caches/Homebrew/go–1.13.3.catalina.bottle.tar.gz… (148MB) Removing: /Users/ME/Library/Caches/Homebrew/readline–8.0.1.mojave.bottle.tar.gz… (517.9KB) Removing: /Users/ME/Library/Logs/Homebrew/go… (64B) Error: Permission denied @ apply2files - /usr/local/share/ghostscript/9.16/Resource/CIDFSubst/AppleGothic.ttf

    これはよくわからんけど、もう一度実行したらもうインストールされてるって出たからOK

  2. Hugo実行

    hugo new site getter_portfolio
    

    Congratulations! Your new Hugo site is created in /Users/ME/works/getter_portfolio.

    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 ” command.
    2. Perhaps you want to add some content. You can add single files with “hugo new /.”.
    3. Start the built-in live server via “hugo server”.

    Visit https://gohugo.io/ for quickstart guide and full documentation.

  3. サーバー実行してみる

    hugo server
    

    Building sites … WARN 2020/02/11 13:04:24 found no layout file for “HTML” for kind “taxonomyTerm”: You should create a template file which matches Hugo Layouts Lookup Rules for this combination. WARN 2020/02/11 13:04:24 found no layout file for “HTML” for kind “home”: You should create a template file which matches Hugo Layouts Lookup Rules for this combination. WARN 2020/02/11 13:04:24 found no layout file for “HTML” for kind “taxonomyTerm”: You should create a template file which matches Hugo Layouts Lookup Rules for this combination.

                   | EN  
    

    ——————-+—– Pages | 3
    Paginator pages | 0
    Non-page files | 0
    Static files | 0
    Processed images | 0
    Aliases | 0
    Sitemaps | 1
    Cleaned | 0

    Built in 10 ms Watching for changes in /Users/ME/works/getter_portfolio/{archetypes,content,data,layouts,static} Watching for config changes in /Users/ME/works/getter_portfolio/config.toml Environment: “development” 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 WARN 2020/02/11 13:04:41 found no layout file for “HTML” for kind “home”: You should create a template file which matches Hugo Layouts Lookup Rules for this combination.

    http://localhost:1313/にも何も出ないけど接続はできてる

  4. ビルド

    hugo
    

    Building sites … WARN 2020/02/11 13:07:59 found no layout file for “HTML” for kind “taxonomyTerm”: You should create a template file which matches Hugo Layouts Lookup Rules for this combination. WARN 2020/02/11 13:07:59 found no layout file for “HTML” for kind “home”: You should create a template file which matches Hugo Layouts Lookup Rules for this combination. WARN 2020/02/11 13:07:59 found no layout file for “HTML” for kind “taxonomyTerm”: You should create a template file which matches Hugo Layouts Lookup Rules for this combination.

                   | EN  
    

    ——————-+—– Pages | 3
    Paginator pages | 0
    Non-page files | 0
    Static files | 0
    Processed images | 0
    Aliases | 0
    Sitemaps | 1
    Cleaned | 0

    Total in 16 ms

    一応Publicが生成された

  5. 公開設定

    config.tomlに publishDir = "docs" を追記してください。

  6. テーマ適用

    themes内で

    git clone https://github.com/gcushen/hugo-academic.git
    

    いやよくわからん

    もしかしてここまでの作業全部無意味?(多分hugoのインストール終わっていればここからでOK)

    git clone https://github.com/sourcethemes/academic-kickstart.git My_Website
    

    これだけでいいんじゃないか?

    cd My_Website
    git submodule update --init --recursive
    
    hugo server
    

    で普通にAcademicのデフォルトの画面がhttp://localhost:1313/で表示された。

  7. 中身書き換えていく

    基本的に content/home/ の中のMarkdownファイルを書き換えることでコンテンツの作成が可能です。(Homeだけは、 content/authors/admin/_index.md です。)

    demo.mdは active = falseとした。

    省略…

  8. 公開

    githubに {username}.github.io という名前のリポジトリを作成します。 その後、CLIで、

    hugo
    cd public
    git init
    git add .
    git commit -m "first commit"
    git remote add origin https://github.com/{username}/{username}.github.io.git
    git push -u origin master
    

    とし、 https://{username}.github.io/ にアクセスすると、ビルドしたページが表示されます。

めっちゃ簡単だった…