• Stars
    star
    128
  • Rank 281,044 (Top 6 %)
  • Language
  • License
    Creative Commons ...
  • Created over 1 year ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

No CSS, no JS. One static HTML page to start you off.

Minimum Viable Hugo

Hugo is a web framework which is frequently used to generate content from Markdown. This repository helps new users get started.

image

4 out of 5 web devs have experienced the following:

"Hugo sounds great! Let me try it out!"
"Okay, I made a new theme and a page in content/!!"
"Running hugo server -D now!!! ... Where is it!!!!"

This repo aims to fix that.

Quickstart

Updated June 2023 for Hugo v0.113.0.

# Start a new site.
# We --force because this will complain
# if *anything* else is in the directory,
# even something so meek as a freshborn .git/.
hugo new site . --force

# Make a new theme. Tell Hugo we want to use it.
hugo new theme minimum-viable-hugo
echo "theme = 'minimum-viable-hugo'" >> hugo.toml

# GOTCHA #1: Your root page is called _index.md.
hugo new _index.md
echo "Lorem ipsum dolor sit amet" >> content/_index.md

# GOTCHA #2: Hugo needs to be explicitly told to
# serve content from _index.md.
echo "{{ .Content }}" >> themes/minimum-viable-hugo/layouts/index.html

# Serve the site. Don't leave out the -D yet.
hugo server -D

Then go to localhost:#### in your browser and you should see it.

If you look at content/_index.md, it will look like

---
title: ""
date: 2023-02-27T18:21:50+02:00
draft: true
---

Lorem ipsum dolor sit amet

Change draft to false. Then you'll be able to run your site with just

hugo server




Advanced

Programming _index.md

There's nothing wrong with using Hugo and _index.md just to create one giant, plain, HTML page.

Eventually you might want to start adding things to it programmatically, using the YAML frontmatter. That's where that layouts/index.html comes in again.

image

If getting _index.md to print content is the "Hello, World!" of Hugo, then editing a layouts/ file is its FizzBuzz. It gives you the minimum viable mental model to start digging in and figuring out which layouts/ file you need to edit to do what you want.

One last tip: Keeping HTML comments

Hugo is designed for professionals. As such, any comments you add to a layouts/ page are stripped out by default.

However this can make learning the flow of template file to template file hard. So here's a workaround:

{{"<!-- from layouts/index.html -->" | safeHTML }}

And here's us looking at the comment in the source code of the page:

image

More Repositories

1

shell-bling-ubuntu

A few scripts to be run on a fresh-off-the-presses Ubuntu VM, in order to get its shell nice 'n purdy.
Shell
89
star
2

finstem

Simple Finnish stem word finder
Python
19
star
3

selkouutiset-archive

Daily archive of YLE Selkouutiset. Updates every day around 6 PM.
HTML
9
star
4

resorter

Simpler to install fork of https://www.gwern.net/Resorter#source-code
R
8
star
5

anki-zero

Like Inbox Zero, but for your Anki reviews. Hooks into Beeminder.
Python
4
star
6

selkouutiset-scrape

Scrape of https://yle.fi/selkouutiset using the technique at https://simonwillison.net/2020/Oct/9/git-scraping/.
HTML
4
star
7

til

Today I Learned (TIL) - content / Markdown files only. See https://github.com/hiAndrewQuinn/til-site for the Hugo site we build using this as a submodule!
Shell
4
star
8

hypermodern-fastapi

One REST endpoint, infinite code coverage!
Python
3
star
9

table2anki

HTML tables to Anki card packages. Does what it says on the tin!
Python
3
star
10

EECS-475-PSets

Repository for the code I wrote completing the problem sets of EECS 475: Fundamentals and Applications of Machine Learning, with Dr. Katsaggelos of Northwestern University.
Python
2
star
11

wordmeat

Generate high-quality practice sentences for learning a foreign language using the OpenAI API.
Java
2
star
12

Obsidian-vault

My Obsidian vault. Published @ https://publish.obsidian.md/aaq/
JavaScript
1
star
13

vot5

a semi-readable rotation cypher
Python
1
star
14

cpp-flashgrams

C++ programs tiny enough to fit on an Anki flashcard.
C++
1
star
15

wiktionary2sqlite

Lil side project to generate a SQLite database I can easily look up words from based on the English Wiktionary dumps.
Python
1
star