Hugo Prose is a minimalist theme derived from the XMin theme, and inspired by Wowchemy (previously known as the Academic theme), Distill, and tufte.css. This theme itself is completely plain-text and lightweight, and does not use any icons, images, or emojis.1 By default, the theme only uses two JavaScript libraries, MathJax and highlight.js, and they are loaded only when necessary. The rest of JavaScript is written from scratch and also relatively short. This theme does not use any CSS frameworks, and the full CSS code is also written from scratch (about 300 lines).
It is not the man who has too little that is poor, but the one who hankers after more.
— Letters from a Stoic
This page introduces the features of this Hugo theme that you can fiddle with.
Site configurations
Below are the possible options that you may configure for a site based on this theme.
Menus
Each page has a menu in the header and a menu in the footer. The header menu is
defined in the header
option in menu
in config.yaml
, and similarly, the
footer menu is defined in the footer
option, e.g.,
menu:
header:
- name: Home
url: ""
weight: 1
- name: About
url: "about/"
weight: 2
footer:
- name: Contact
url: "404.html"
weight: 1
- name: Categories
url: "categories/"
weight: 2
pre: "optional"
The url
of a menu item can be either a relative URL pointing to a page on this
website, or an external link (e.g., url: "https://github.com/yihui"
). The
order of the menu items is determined by the weight
values. If a menu item has
a pre
value, it will be used as the class of the menu item. The special value
optional
indicates that this menu item will be hidden on small screens.2
The header menu can be made sticky via the parameter stickyMenu
in
config.yaml
:
params:
stickyMenu: true
Home page
The body of the home page consists of an introduction, followed by a series of info cards, and then a number of the latest posts and pages.
-
The introduction comes from
content/_index.md
. The Markdown content can contain arbitrary elements. -
The info cards come from the
content/card/
directory. Each (Markdown) file is displayed on the home page as a separate card. The title is displayed vertically on the left or right side.3 If you want to customize the style of a certain card, you may use the YAML optionstyle
in the file, e.g.,--- title: "Courses" style: "background: darkorange; color: white;" ---
This will add a dark orange background to the card, and change the color of text to white. You can use any CSS styles here (e.g.,
font-size
,background-image
, andpadding
). -
The number of latest posts and pages can be defined via the
homePosts
option inparams
inconfig.yaml
, e.g.,params: homePosts: 10
The default is 6.
-
The
mainSections
parameter can be used to select the sections of pages to be included on the home page, e.g.,params: mainSections: ["post", "news"]
Footer
Besides the menu in the footer, you can specify a copyright statement in the
footer
parameter in config.yaml
, e.g.,
params:
footer: "© Frida Gomam 2015 -- 2020"
Comments
Disqus, Utterances
Searching
This theme supports searching out of the box based on Fuse.js. A few critical configurations:
-
The site needs to generate a JSON index. This is done via a layout file
index.json.json
inlayouts/_default/
, and the config inconfig.yaml
:outputs: home: [html, rss, json]
-
A menu item with the ID
menu-search
configured inconfig.yaml
, e.g.,menu: header: - name: Search url: "#" identifier: menu-search
-
The version of Fuse can be configured via the parameter
fuseVersion
inconfig.yaml
, e.g.,params: fuseVersion: 6.4.3
If no
fuseVersion
is specified, the latest version of Fuse.js will be used. You may also download a copy of Fuse.js to thestatic/
folder of your site and use this copy instead of loading it from CDN. To do that, you may download Fuse.js to, say,static/js/fuse.js
and modify the partial templatelayouts/partials/foot_custom.html
. Replace{{ with .Site.Params.fuseVersion }} <script src="https://cdn.jsdelivr.net/npm/fuse.js@{{ . }}"></script> {{ end }}
with
<script src="{{ relURL "/js/fuse.js" }}"></script>
That way, you can also use search when viewing the site offline, because Fuse.js is no longer loaded from CDN.
Articles
At the moment, I’m too tired to complete the documentation. If you want to be an early adopter of this theme, you might have to read the source.
Multiple authors
If an article has multiple authors, specify their names in an array in the
author
field.
Author’s bio is loaded from the database data/authors.yaml
.
Table of contents
TOC can be automatically generated, no matter if you use Hugo/goldmark or Pandoc/R Markdown.
Number sections
Section headers can be automatically numbered, no matter if you use Hugo/goldmark or Pandoc/R Markdown.
Footnotes, citations, and sidenotes
Footnotes and citation entries4 are moved to the right margin by default. If
you want to write arbitrary sidenotes, use the classes side
and
side-left
/side-right
.
This is a sidenote on the left side. You can include anything in the note. For example, here is a bullet list:
- Get up
- Do the work
- Go to bed
<div class="side side-left">
Content to be displayed as a sidenote.
</div>
Appendix
-
Author’s bio
-
Custom fields
-
License
-
Suggest changes
Drafts
Mark an article as draft by adding draft: true
to the YAML metadata. Draft
articles are styled with a background of diagonal lines and a watermark “Draft.”
For listing pages, draft articles are also indicated by the background.
Floats
Full-width elements
Apply the class fullwidth
, e.g.,
<div class="fullwidth">
Content to be displayed with its maximum width.
</div>
If you want the full-width element to be scrollable, you can apply an additional
class fullscroll
, e.g.,
<div class="fullwidth fullscroll">
Super wide content to be scrolled horizontally.
</div>
Embedded elements
Use the embed-left
or embed-right
class to embed a content block to be
floated to the left or right, and the block will exceed the article margin by
200px, e.g.,
<div class="embed-right">
Content to be embedded onto the margin.
</div>
One application is to embed videos in an article, when the video needs a narrative. For example, you can embed a video on the right side, and provide a narrative in the body of the article, which will be on the left side of the video.
By default, the max-width
of the embedded element is 600px (the actual width
could be smaller), out of which 200px will be in the margin, meaning that there
will be at least 400px left for the narrative in the article body.
When the screen width is smaller than 1200px, the embedded elements will be floated back into the article as normal block-level elements.
Quotes
Use the quote-left
or quote-right
class to make content float to the left or
right.
<div class="quote-left">
A quote to be floated to the left.
</div>
The quotes do not have to be literally quotes. These environments can contain any content, although quotes may be the most common application.
Here is a quote that I’ve never said.
The default width of the content is 45% of the container. You have seen an
example of quote-right
at the beginning of this article. Here is an example of
quote-left
on the left side. The quotes will stop floating and become normal
block-level elements when the screen width is smaller than 800px.
List pages
Open face characters
The first alphabetical character in each summary block is converted to an open face character such as:
𝔸 𝔹 ℂ 𝔻 𝔼 𝔽 𝔾 ℍ 𝕀 𝕁 𝕂 𝕃 𝕄 ℕ 𝕆 ℙ ℚ ℝ 𝕊 𝕋 𝕌 𝕍 𝕎 𝕏 𝕐 ℤ 𝕒 𝕓 𝕔 𝕕 𝕖 𝕗 𝕘 𝕙 𝕚 𝕛 𝕜 𝕝 𝕞 𝕟 𝕠 𝕡 𝕢 𝕣 𝕤 𝕥 𝕦 𝕧 𝕨 𝕩 𝕪 𝕫
Navigation links
Responsive design
Screen size
Attribute \ width | 650 - 800px | 800 - 1264px | > 1264px | |
---|---|---|---|---|
Menu | optional items | hidden | shown | <= |
Table of contents | position | => | body / static | left margin / sticky |
Floats | position | => | body / static | beside or overlapping body |
Sidenotes | position | => | body / static | side |
Home posts | layout | one column | two columns | <= |
Dark theme
This theme uses the
prefer-color-scheme
CSS media feature to respond to the dark color theme of the system. If you
change your system to the dark mode, the web pages will automatically switch to
the dark mode.
Custom layouts
TODO
section anchors
-
This example website does contain images and videos as demos, though. ↩︎
-
For example,
pre: "optional"
will generate the menu item<li class="optional">
. It may be an unimportant item that you do not mind hiding on smaller screens. ↩︎ -
We recommend that you keep the title short so it can fit on one line. ↩︎
-
Note that if you want to use citations, you have the R Markdown format with the R package blogdown. Plain Markdown posts (
.md
files) do not support citations. ↩︎