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. 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; } .emojify { font-family: Apple Color Emoji, Segoe UI Emoji, NotoColorEmoji, Segoe UI Symbol, Android Emoji, EmojiSymbols; font-size: 2rem; vertical-align: middle; } @media screen and (max-width:650px) { .nowrap { display: block; margin: 25px 0; } }
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 — elements represent six levels of section headings. is the highest section level while is the lowest. H1 H2 H3 H4 H5 H6 Paragraph 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. Blockquote with attribution Don’t communicate by sharing memory, share memory by communicating.— Rob Pike1 Tables Tables aren’t part of the core Markdown spec, but Hugo supports supports them out-of-the-box. Name Age Bob 27 Alice 23 Inline Markdown within tables Italics Bold Code italics bold code Code Blocks Code block with backticks html lang="en" head meta charset="utf-8" titleExample HTML5 Documenttitle head body pTestp body html Code block indented with four spaces Example HTML5 Document Test Code block with Hugo’s internal highlight shortcode html lang="en" head meta charset="utf-8" titleExample HTML5 Documenttitle head body pTestp body html 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 GIFis a bitmap image format. H2O Xn+ Yn= ZnPress CTRL+ALT+Deleteto end the session. Most salamandersare nocturnal, and hunt for insects, worms, and other small creatures. The above quote is excerpted from Rob Pike’s talk during Gopherfest, November 18, 2015. ↩︎
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 like so: {{ if or .Params.math .Site.Params.math }} {{ partial "math.html" . }} {{ end }} To enable KaTex globally set the parameter math to true 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} } } $$
Assets (js/css) The following is enabled by default minification - makes the assets size smallest as possible. bundling - bundles all the styles in one single asset fingerprint/intergity check. Default Theme light/dark/auto params: # defaultTheme: light # defaultTheme: dark defaultTheme: auto # to switch between dark or light according to browser theme Theme Switch Toggle (enabled by default) Shows icon besides title of page to change theme To disable it : disableThemeToggle : true Archives Layout Create a page with archive.md Add vars below to its page-variables layout: "archives" ex: archives.md Home-Info Mode Use 1st entry as some Information add following to config file params: homeInfoParams: Title: Hi there wave Content: Can be Info, links, about... socialIcons: # optional - name: "" url: "" - name: "" url: "" ex. here Profile Mode Shows Index/Home page as Full Page with Social Links and Image add following to config file params: profileMode: enabled: true title: "" # optional default will be site title imageUrl: "" # optional imageTitle: "" # optional buttons: - name: Archive url: "/archive" - name: Github url: "https://github.com/" socialIcons: # optional - name: "" url: "" - name: "" url: "" Draft Page indication adds [draft] mark to indicate draft pages. Post Cover Image In post’s page-variables add : cover: image: '' # can also paste direct link from external site # ex. https://i.ibb.co/K0HVPBd/paper-mod-profilemode.png alt: '' caption: '' When you include images in the Page Bundle, multiple sizes of the image will automatically be provided using the HTML5 srcset field. To reduce generation time and size of the site, you can disable this feature using params: cover: responsiveImages: false To enable hyperlinks to the full image size on post pages, use params: cover: linkFullImages: true Share Buttons on post Displays Share Buttons at Bottom of each post to show share buttons add params: ShowShareButtons: true Show post reading time Displays Reading Time (the estimated time, in minutes, it takes to read the content.) To show reading time add Params: ShowReadingTime: true Show Table of Contents (Toc) on blog post Displays ToC on blog-pages To show ToC add following to page-variables ShowToc: true To keep Toc Open by default on a post add following to page-variables: TocOpen: true Comments to add comments, create a html file layouts/partials/comments.html and paste code provided by your comments provider also in config add this params: comments: true read more about this here Misc Scroll-Bar themed (by default) Smooth Scroll between in-page links (by default) Scroll-to-Top Button (by default) Displays a Scroll-to-Top button in right-bottom corner Google Analytics integration Open-Graph support Twitter Cards Support Syntax highlighting Twitter cards and opengraph tags support RSS feeds Multilingual Support
Intro We’ll be using yml/yaml format for all examples down below, I recommend using yml over toml as it is easier to read. Override theme template By Hugo’s Lookup Order, you can override any part of a theme that you want. The following is a quick example. Let’s say you wish the list was different. All you have to do is copy the list template: your-site/themes/papermod/layouts/_defaults/list.html And paste it under your own layouts folder: your-site/layouts/_defaults/list.html Then you’re free to make any changes you want to the list. When Hugo builds your site, your copy of list.html will be used instead of the theme’s list.html. Enable Social-Metadata and SEO These include OpenGraph, Twitter Cards and Schema. params: env: production or set HUGO_ENV as “production” in system env-vars Archive Page . ├── config.yml ├── content/ │ ├── archives.md and add the following to it --- title: "Archive" layout: "archives" url: "/archives/" summary: archives --- References Override a Hugo theme
Social Icons Usage : socialIcons: # optional - name: "" url: "" - name: "" url: "" No. name platform link 1 123rf 123rf.com 2 adobestock stock.adobe.com 3 behance behance.net 4 codepen codepen.io 5 cryptohack cryptohack.org 6 dev dev.to 7 discogs discogs.com 8 dreamstime dreamstime.com 9 dribbble dribbble.com 10 email - 11 facebook facebook.com 12 freepik freepik.com 13 github github.com 14 gitlab gitlab.com 15 hackerrank hackerrank.com 16 hackthebox hackthebox.eu 17 instagram instagram.com 18 lastfm last.fm 19 linkedin linkedin.com 20 mixcloud mixcloud.com 21 paypal paypal.com 22 qq qq.com 23 soundcloud soundcloud.com 24 shutterstock shutterstock.com 25 slack slack.com 26 sourcerer sourcerer.io 27 stackoverflow stackoverflow.com 28 steam steampowered.com 29 telegram telegram.org 30 twitch twitch.tv 31 twitter twitter.com 32 youtube youtube.com other - Share Icons No. Platform 1 facebook 2 linkedin 3 reddit 4 telegram 5 twitter 6 whatsapp Usage: params: ShowShareButtons: true
Guide Follow this guide to setup hugo and create a new site. Make sure you install latest version of hugo(=0.74.0). After you have created a new site, at Step 3 follow the steps: Inside the folder of your Hugo site, run: git clone https://github.com/adityatelange/hugo-PaperMod themes/hugo-PaperMod --depth=1 Updating theme : cd themes/hugo-PaperMod git pull or you can use as submodule with git submodule add https://github.com/adityatelange/hugo-PaperMod.git themes/hugo-PaperMod git submodule update --init --recursive Updating theme with submodule : git submodule update --remote --merge Then change in config.yml: theme: "hugo-PaperMod" Example Site Structure is present here: exampleSite Sample config.yml baseURL: 'https://examplesite.com' title: ExampleSite paginate: 5 theme: hugo-PaperMod enableRobotsTXT: true buildDrafts: false buildFuture: false buildExpored: false googleAnalytics: UA-123-45 minify: disableXML: true minifyOutput: true params: env: production # to enable google analytics, opengraph, twitter-cards and schema. title: ExampleSite description: 'ExampleSite's description' author: Me images: "" ShowReadingTime: true ShowShareButtons: true comments: false defaultTheme: auto disableThemeToggle : false disableSpecial1stPost : false assets: favicon: '' label: text: "Home" icon: /apple-touch-icon.png iconHeight: 35 # profile-mode profileMode: enabled: false # needs to be explicitly set title: ExampleSite # imageUrl: '' # imageTitle: my image buttons: - name: Posts url: posts - name: Tags url: tags # home-info mode homeInfoParams: Title: "Hi there \U0001F44B" Content: Welcome to my blog socialIcons: - name: twitter url: 'https://twitter.com/' - name: stackoverflow url: 'https://stackoverflow.com' - name: github url: 'https://github.com/' analytics: google: SiteVerificationTag: "XYZabc" Sample Page.md --- title: "My 1st post" date: 2020-09-15T11:30:03+00:00 weight: 1 aliases: ['/first'] tags: ['first'] author: "Me" showToc: true TocOpen: false draft: false hidemeta: false disableShare: false cover: image: '' alt: '' caption: '' relative: false comments: false --- Papermod - Features Papermod - How to Guide Papermod - Icons
Variables in PaperMod Below are variables used with this theme… Site Variables name type example ShowReadingTime boolean true | false defaultTheme string light | dark | auto ShowShareButtons boolean true | false cover.linkFullImages boolean true | false cover.responsiveImages boolean true | false Page Variables name type example showtoc boolean true | false tocopen boolean true | false hidemeta boolean true | false cover.image string 'featured.jpg' cover.caption string '' cover.alt string ''
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. Instagram Simple Shortcode YouTube Privacy Enhanced Shortcode Twitter Simple Shortcode “In addition to being more logical, asymmetry has the advantage that its complete appearance is far more optically effective than symmetry.” — Jan Tschichold pic.twitter.com/gcv7SrhvJb — Graphic Design History (@DesignReviewed) January 17, 2019 Vimeo Simple Shortcode .__h_video { position: relative; padding-bottom: 56.23%; height: 0; overflow: hidden; width: 100%; background: #000; } .__h_video img { width: 100%; height: auto; color: #000; } .__h_video .play { height: 72px; width: 72px; left: 50%; top: 50%; margin-left: -36px; margin-top: -36px; position: absolute; cursor: pointer; }