this is my go to documentation for editing posts on this hugo site. it still uses markdown, but with some touch of style here and there.
Article frontmatter:
Use front matter to add metadata to your content.
https://gohugo.io/content-management/front-matter/
---
author: ["Hugo Authors", "PaperMod Contributors", "Aditya Telange"]
title: "Comprehensive Frontmatter Example"
date: "2019-03-11"
description: "A comprehensive guide showcasing Markdown, shortcodes, syntax, and formatting for HTML elements."
summary: "Sample article demonstrating various frontmatter fields and their usage."
tags: ["markdown", "shortcodes", "privacy", "syntax", "code", "gist", "css", "html", "themes", "emoji"]
categories: ["themes", "syntax"]
series: ["Themes Guide"]
FAtags: ["markdown", "css", "html", "themes"]
FAcategories: ["themes", "syntax"]
FAseries: ["Themes Guide"]
aliases: ["migrate-from-jekyl"]
cover:
image: images/msg.png
caption: "Generated using [OG Image Playground by Vercel](https://og-playground.vercel.app/)"
social:
fediverse_creator: "@adityatelange@mastodon.social"
math: true
weight: 2
ShowToc: true
TocOpen: true
ShowBreadCrumbs: false
---
Inline Code
This is Inline Code
Only pre
This is pre text
Code block with backticks
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Example HTML5 Document</title>
<meta
name="description"
content="Sample article showcasing basic Markdown syntax and formatting for HTML elements."
/>
</head>
<body>
<p>Test</p>
</body>
</html>
Code block with backticks and language specified
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Example HTML5 Document</title>
<meta
name="description"
content="Sample article showcasing basic Markdown syntax and formatting for HTML elements."
/>
</head>
<body>
<p>Test</p>
</body>
</html>
Code block with backticks and language specified with line numbers
|
|
Code block with line numbers and highlighted lines
- PaperMod supports
linenos=true
orlinenos=table
|
|
Withlinenos=inline
line might not get highlighted properly.- This issue is fixed with 045c084
1<!DOCTYPE html>
2<html lang="en">
3 <head>
4 <meta charset="utf-8" />
5 <title>Example HTML5 Document</title>
6 <meta
7 name="description"
8 content="Sample article showcasing basic Markdown syntax and formatting for HTML elements."
9 />
10 </head>
11 <body>
12 <p>Test</p>
13 </body>
14</html>
Code block indented with four spaces
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Example HTML5 Document</title>
</head>
<body>
<p>Test</p>
</body>
</html>
Code block with Hugo’s internal highlight shortcode
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Example HTML5 Document</title>
</head>
<body>
<p>Test</p>
</body>
</html>
Github Gist
https://gohugo.io/shortcodes/gist/
To display a specific file within the gist:
Emoji
Emoji can be enabled in a Hugo project in a number of ways.
The emojify
function can be called directly in templates or Inline Shortcodes.
To enable emoji globally, set enableEmoji
to true
in your site’s configuration and then you can type emoji shorthand codes directly in content files; e.g.
🙈 :see_no_evil:
🙉 :hear_no_evil:
🙊 :speak_no_evil:
The Emoji cheat sheet is a useful reference for emoji shorthand codes.
N.B. The above steps enable Unicode Standard emoji characters and sequences in Hugo, however the rendering of these glyphs depends on the browser and the platform. To style the emoji you can either use a third party emoji font or a font stack; e.g.
.emoji {
font-family: Apple Color Emoji, Segoe UI Emoji, NotoColorEmoji, Segoe UI Symbol, Android Emoji, EmojiSymbols;
}
This article offers a sample of basic Markdown syntax that can be used in Hugo content files, also it shows whether basic HTML elements are decorated with CSS in a Hugo theme.
Headings
The following HTML <h1>
—<h6>
elements represent six levels of section headings. <h1>
is the highest section level while <h6>
is the lowest.
H1
H2
H3
H4
H5
H6
# H1
## H2
### H3
#### H4
##### H5
###### H6
Paragraph
just type stuff
Xerum, quo qui aut unt expliquam qui dolut labo. Aque venitatiusda cum, voluptionse latur sitiae dolessi aut parist aut dollo enim qui voluptate ma dolestendit peritin re plis aut quas inctum laceat est volestemque commosa as cus endigna tectur,
offic to cor sequas etum rerum idem sintibus eiur? Quianimin porecus evelectur, cum que nis nust voloribus ratem aut omnimi, sitatur? Quiatem. Nam, omnis sum am facea corem alique molestrunt et eos evelece arcillit ut aut eos eos nus, sin conecerem erum fuga.
Ri oditatquam, ad quibus unda veliamenimin cusam et facea ipsamus es exerum sitate dolores editium rerore eost, temped molorro ratiae volorro te reribus dolorer sperchicium faceata tiustia prat.
Itatur? Quiatae cullecum rem ent aut odis in re eossequodi nonsequ idebis ne sapicia is sinveli squiatum, core et que aut hariosam ex eat.
Blockquotes
The blockquote element represents content that is quoted from another source, optionally with a citation which must be within a footer
or cite
element, and optionally with in-line changes such as annotations and abbreviations.
Blockquote without attribution
Tiam, ad mint andaepu dandae nostion secatur sequo quae. Note that you can use Markdown syntax within a blockquote.
> Tiam, ad mint andaepu dandae nostion secatur sequo quae.
> **Note** that you can use _Markdown syntax_ within a blockquote.
Blockquote with attribution
Don’t communicate by sharing memory, share memory by communicating.
— Rob Pike1
> Don't communicate by sharing memory, share memory by communicating.
>
> — <cite>Rob Pike[^1]</cite>
[^1]: The above quote is excerpted from Rob Pike's [talk](https://www.youtube.com/watch?v=PAAkCSZUG1c) during Gopherfest, November 18, 2015.
Tables
Tables aren’t part of the core Markdown spec, but Hugo supports them out-of-the-box.
Name | Age |
---|---|
Bob | 27 |
Alice | 23 |
Inline Markdown within tables
Italics | Bold | Code |
---|---|---|
italics | bold | code |
List Types
Ordered List
- First item
- Second item
- Third item
Unordered List
- List item
- Another item
- And another item
Nested list
- Fruit
- Apple
- Orange
- Banana
- Dairy
- Milk
- Cheese
Other Elements — abbr, sub, sup, kbd, mark
GIF is a bitmap image format.
H2O
Xn + Yn = Zn
Press CTRL+ALT+Delete to end the session.
Most salamanders are nocturnal, and hunt for insects, worms, and other small creatures.
Mathematical notation in a Hugo project can be enabled by using third party JavaScript libraries.
In this example we will be using KaTeX
- Create a partial under
/layouts/partials/math.html
- Within this partial reference the Auto-render Extension or host these scripts locally.
- Include the partial in your templates (
extend_head.html
) like so: - refer ISSUE #236
{{ if or .Params.math .Site.Params.math }}
{{ partial "math.html" . }}
{{ end }}
- To enable KaTex globally set the parameter
math
totrue
in a project’s configuration - To enable KaTex on a per page basis include the parameter
math: true
in content files
Note: Use the online reference of Supported TeX Functions
Examples
Inline math: \(\varphi = \dfrac{1+\sqrt5}{2}= 1.6180339887…\)
Block math:
$$ \varphi = 1+\frac{1} {1+\frac{1} {1+\frac{1} {1+\cdots} } } $$
RIch content
Hugo ships with several Built-in Shortcodes for rich content, along with a Privacy Config and a set of Simple Shortcodes that enable static and no-JS versions of various social media embeds.
Figure Shortcode (PaperMod enhanced)
Photo by Aditya Telange on Unsplash
YouTube
X (Twitter) Shortcode
PaperMod is now the most starred @GoHugoIO theme on #GitHub ! ✨
— Aditya Telange (@adityatelange) November 14, 2023
Here's what it offers:
- Simple, minimal & clean design
- Light/Dark mode
- Fuzzy search for content
- Good page-speed insights
and much more...
Huge thanks to all supporters🙏https://t.co/YAEd2cfrrn