Skip to content

Instantly share code, notes, and snippets.

@novotnyr
Last active January 5, 2020 20:25
Show Gist options
  • Select an option

  • Save novotnyr/976cd370165b3af27896d63006d57445 to your computer and use it in GitHub Desktop.

Select an option

Save novotnyr/976cd370165b3af27896d63006d57445 to your computer and use it in GitHub Desktop.

Zalozenie

hugo new site .

Zalozenie noveho clanku

hugo new content/index.md

Clanky su:

  • vo formate Markdown
  • s YAML preambulou
  • a priponou .md

Editacia prveho suboru

/tmp/blog⟩ cat content/index.md
---
title: "Content"
date: 2020-01-05T21:09:10+01:00
draft: true
---
  • Title: nadpis
  • Date: datum, pozor musi byt bud full vratane timezony alebo len datum 2020-01-05. Pri chybe v datume sa Hugo zvykne zblaznit a nepublikovat.
  • Draft: Drafty sa nepublikuju, ale renderuju v embedded serveri. Pre realne clanky treba vyhodit cely riadok

Temy

cd themes
git clone [email protected]:goodroot/hugo-classic.git
cd ..

Konfigurak config.toml a temy

Konfigurak config.toml je v korenovom adresasri

vim config.toml

Dolezite veci:

baseURL = "http://example.org/"
languageCode = "en-us"
title = "My New Hugo Site"
theme = "hugo-classic"
  • baseUrl: prefixnuta pred linky. Treba dat URL z GitHubu, napr. https://novotnyr.github.io/
  • theme: nazov adresara temy

Spustenie servera

hugo -D server

V browseri: http://localhost:1313/

Publikovanie

hugo

Vyrenderuje vsetko do public. Tento adresar treba git-pushnut do repozitara na GitHube.

Interakcia s GitHubom

Ak mam usera novotnyr, mozem publikovat na adresu https://novotnyr.github.io. Potrebujem zalozit repo na GitHube s nazvom novotnyr.github.io (ano, cele domenove meno je nazov repa).

Potom v lokalnom adresari s Hugom vyhlasim adresar public za gitovy submodul namapovany na githubove repo novotnyr.github.io.

rm -rf public
git submodule add -b master [email protected]:novotnyr/novotnyr.github.io.git public

Nasledne viem vybuildovat hugo a adresar public pushnut.

hugo
cd public && \
git add . && \
git commit -m "Deploy website" && \
git push && \
cd ..
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment