2020-09-17 10:58:09 +02:00
---
2023-12-15 17:22:06 +01:00
title: "Features / Mods"
2021-08-18 17:02:36 +02:00
summary: Learn About All Features in PaperMod
2021-01-20 15:47:35 +01:00
date: 2021-01-20
2020-09-17 10:58:09 +02:00
weight: 2
2020-10-27 14:16:08 +01:00
aliases: ["/papermod-features"]
2023-12-15 17:22:06 +01:00
tags: ["PaperMod", "Docs"]
author: ["Aditya Telange"]
2020-09-17 10:58:09 +02:00
---
2021-03-28 06:36:21 +02:00
### Intro
2021-02-01 06:47:12 +01:00
2022-06-10 18:19:13 +02:00
- **We'll be using `yml/yaml` format for all examples down below, I recommend using `yml` over `toml` as it is easier to read.**
2021-02-01 06:47:12 +01:00
2022-06-10 18:19:13 +02:00
- You can find any [YML to TOML ](https://www.google.com/search?q=yml+to+toml ) converters if necessary.
2021-02-01 06:47:12 +01:00
---
2020-10-06 09:31:20 +02:00
### Assets (js/css)
2020-10-27 14:16:08 +01:00
2020-09-17 10:58:09 +02:00
The following is enabled by default
2020-10-27 14:16:08 +01:00
2022-06-10 18:19:13 +02:00
- [minification ](https://gohugo.io/hugo-pipes/minification/ ) - makes the assets size smallest as possible.
- [bundling ](https://gohugo.io/hugo-pipes/bundling/ ) - bundles all the styles in one single asset
- [fingerprint/intergity ](https://gohugo.io/hugo-pipes/fingerprint/ ) check.
2020-09-17 10:58:09 +02:00
---
2020-10-06 09:31:20 +02:00
### Default Theme light/dark/auto
2020-09-17 10:58:09 +02:00
2023-12-15 17:22:06 +01:00
```yml {linenos=true}
2020-09-17 10:58:09 +02:00
params:
2022-06-10 18:19:13 +02:00
# defaultTheme: light
# defaultTheme: dark
defaultTheme: auto # to switch between dark or light according to browser theme
2020-09-17 10:58:09 +02:00
```
2020-10-27 14:16:08 +01:00
2020-10-06 09:31:20 +02:00
< / details >
2020-09-17 10:58:09 +02:00
2020-10-06 09:31:20 +02:00
---
2020-09-17 10:58:09 +02:00
2020-10-06 09:31:20 +02:00
### Theme Switch Toggle (enabled by default)
2020-09-24 07:48:03 +02:00
2020-10-06 09:31:20 +02:00
Shows icon besides title of page to change theme
To disable it :
2020-09-24 07:48:03 +02:00
2023-12-15 17:22:06 +01:00
```yml {linenos=true}
2020-10-27 14:16:08 +01:00
disableThemeToggle: true
2020-09-24 07:48:03 +02:00
```
2020-11-04 10:38:16 +01:00
You can refer following table for better understanding...
| `defaultTheme` | `disableThemeToggle` | checks local storage? | checks system theme? | Info |
| -------------- | -------------------- | --------------------- | -------------------- | ----------------- |
| `auto` | true | No | Yes | only system theme |
| | false | Yes (if not->2) | Yes (2) | _switch present_ |
| `dark` | true | No | No | force dark only |
| | false | Yes | No | _switch present_ |
| `light` | true | No | No | force light only |
| | false | Yes | No | _switch present_ |
2020-09-17 10:58:09 +02:00
---
2020-10-06 09:31:20 +02:00
### Archives Layout
2020-09-17 10:58:09 +02:00
2020-10-26 17:26:58 +01:00
Create a page with `archive.md` in `content` directory with following content
2020-09-17 10:58:09 +02:00
2021-02-01 06:47:12 +01:00
```shell
.
├── config.yml
├── content/
│ ├── archives.md < --- Create archive . md here
│ └── posts/
├── static/
└── themes/
└── PaperMod/
```
and add the following to it
2020-09-17 10:58:09 +02:00
```yml
2020-10-26 17:26:58 +01:00
---
2021-02-01 06:47:12 +01:00
title: "Archive"
layout: "archives"
url: "/archives/"
summary: archives
2020-10-26 17:26:58 +01:00
---
2020-09-17 10:58:09 +02:00
```
2020-10-26 17:26:58 +01:00
**Note:** Archives Layout does not support Multilingual Month Translations.
2020-10-06 09:31:20 +02:00
ex: [archives.md ](https://raw.githubusercontent.com/adityatelange/hugo-PaperMod/exampleSite/content/archives.md )
2020-09-17 10:58:09 +02:00
---
2020-10-27 15:12:19 +01:00
### Regular Mode (default-mode)
2021-01-20 17:23:44 +01:00
![regular ](images/regular.jpg )
2020-10-27 15:12:19 +01:00
---
2020-10-06 09:31:20 +02:00
### Home-Info Mode
2020-09-17 10:58:09 +02:00
2021-01-20 17:23:44 +01:00
![homeinfo ](images/homeinfo.jpg )
2020-10-27 15:12:19 +01:00
2020-09-17 10:58:09 +02:00
Use 1st entry as some Information
add following to config file
2020-10-27 14:16:08 +01:00
2020-09-17 10:58:09 +02:00
```yml
params:
2023-12-15 17:22:06 +01:00
homeInfoParams:
Title: Hi there wave
Content: Can be Info, links, about...
socialIcons: # optional
- name: "< platform > "
url: "< link > "
- name: "< platform 2 > "
url: "< link2 > "
2020-09-17 10:58:09 +02:00
```
---
2020-10-06 09:31:20 +02:00
### Profile Mode
2020-09-17 10:58:09 +02:00
2021-02-01 06:47:12 +01:00
![profile ](https://raw.githubusercontent.com/adityatelange/hugo-PaperMod/exampleSite/content/posts/papermod/papermod-features/images/profile.jpg )
2020-10-27 15:12:19 +01:00
2020-09-17 10:58:09 +02:00
Shows Index/Home page as Full Page with Social Links and Image
add following to config file
2023-12-15 17:22:06 +01:00
```yml {linenos=true}
2020-09-17 10:58:09 +02:00
params:
2023-12-15 17:22:06 +01:00
profileMode:
enabled: true
title: "< Title > " # optional default will be site title
subtitle: "This is subtitle"
imageUrl: "< image link > " # optional
imageTitle: "< title of image as alt > " # optional
imageWidth: 120 # custom size
imageHeight: 120 # custom size
buttons:
- name: Archive
url: "/archive"
- name: Github
url: "https://github.com/"
socialIcons: # optional
- name: "< platform > "
url: "< link > "
- name: "< platform 2 > "
url: "< link2 > "
2020-09-17 10:58:09 +02:00
```
---
2021-02-07 17:25:52 +01:00
### Search Page
2020-12-06 17:56:32 +01:00
2022-06-25 17:31:16 +02:00
PaperMod uses [Fuse.js Basic ](https://fusejs.io/getting-started/different-builds.html#explanation-of-different-builds ) for search functionality
2021-02-01 06:47:12 +01:00
2020-12-06 17:56:32 +01:00
Add the following to site config, `config.yml`
2023-12-15 17:22:06 +01:00
```yml {linenos=true,hl_lines=[5]}
2020-12-06 17:56:32 +01:00
outputs:
2022-06-10 18:19:13 +02:00
home:
- HTML
- RSS
2023-12-15 17:22:06 +01:00
- JSON # necessary for search
2020-12-06 17:56:32 +01:00
```
Create a page with `search.md` in `content` directory with following content
2023-12-15 17:22:06 +01:00
```yml {linenos=true,hl_lines=[3]}
2020-12-06 17:56:32 +01:00
---
title: "Search" # in any language you want
2023-12-15 17:22:06 +01:00
layout: "search" # necessary for search
2020-12-06 17:56:32 +01:00
# url: "/archive"
2021-02-01 06:47:12 +01:00
# description: "Description for Search"
2020-12-06 17:56:32 +01:00
summary: "search"
2022-06-10 18:19:13 +02:00
placeholder: "placeholder text in search input box"
2020-12-06 17:56:32 +01:00
---
```
2022-06-25 17:31:16 +02:00
To hide a particular page from being searched, add it in post's frontmatter
2021-02-01 06:47:12 +01:00
2023-12-15 17:22:06 +01:00
```yml {linenos=true}
2021-02-01 06:47:12 +01:00
searchHidden: true
```
ex: [search.md ](https://raw.githubusercontent.com/adityatelange/hugo-PaperMod/exampleSite/content/search.md )
2021-02-07 17:25:52 +01:00
> Search Page also has Key bindings:
>
2022-06-10 18:19:13 +02:00
> - Arrow keys to move up/down the list
2022-06-25 17:31:16 +02:00
> - Enter key (return) or Right Arrow key to go to the highlighted page
2022-06-10 18:19:13 +02:00
> - Escape key to clear searchbox and results
2021-02-07 17:25:52 +01:00
2020-12-06 17:56:32 +01:00
For Multilingual use `search.<lang>.md` ex. `search.es.md` .
**Note:** Search will work only on current language, user is currently on !
2020-12-15 14:34:01 +01:00
**Customizing Fusejs Options**
Refer https://fusejs.io/api/options.html for Options, Add those as shown below.
2023-12-15 17:22:06 +01:00
```yml {linenos=true}
2020-12-15 14:34:01 +01:00
params:
2022-06-10 18:19:13 +02:00
fuseOpts:
isCaseSensitive: false
shouldSort: true
location: 0
distance: 1000
threshold: 0.4
minMatchCharLength: 0
2023-08-12 09:52:40 +02:00
# limit: 10 # refer: https://www.fusejs.io/api/methods.html#search
2022-06-10 18:19:13 +02:00
keys: ["title", "permalink", "summary", "content"]
2020-12-15 14:34:01 +01:00
```
2020-12-06 17:56:32 +01:00
---
2020-10-06 09:31:20 +02:00
### Draft Page indication
2020-09-17 10:58:09 +02:00
adds `[draft]` mark to indicate draft pages.
---
2020-10-06 09:31:20 +02:00
### Post Cover Image
2020-09-24 07:48:03 +02:00
In post's page-variables add :
2023-12-15 17:22:06 +01:00
```yml {linenos=true}
2020-10-06 09:31:20 +02:00
cover:
2022-06-10 18:19:13 +02:00
image: "< image path / url > "
# can also paste direct link from external site
# ex. https://i.ibb.co/K0HVPBd/paper-mod-profilemode.png
alt: "< alt text > "
caption: "< text > "
relative: false # To use relative path for cover image, used in hugo Page-bundles
2020-09-24 07:48:03 +02:00
```
2020-10-22 16:05:14 +02:00
When you include images in the [Page Bundle ](https://gohugo.io/content-management/page-bundles/ ), 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
2020-10-27 14:16:08 +01:00
2023-12-15 17:22:06 +01:00
```yml {linenos=true}
2020-10-22 16:05:14 +02:00
params:
2022-06-10 18:19:13 +02:00
cover:
responsiveImages: false
2020-10-22 16:05:14 +02:00
```
To enable hyperlinks to the full image size on post pages, use
2020-10-27 14:16:08 +01:00
2023-12-15 17:22:06 +01:00
```yml {linenos=true}
2020-10-22 16:05:14 +02:00
params:
2022-06-10 18:19:13 +02:00
cover:
linkFullImages: true
2020-10-22 16:05:14 +02:00
```
2020-09-24 08:24:04 +02:00
---
2020-10-06 09:31:20 +02:00
### Share Buttons on post
2020-09-17 10:58:09 +02:00
Displays Share Buttons at Bottom of each post
to show share buttons add
2020-10-27 14:16:08 +01:00
2020-09-17 10:58:09 +02:00
```yml
params:
2022-06-10 18:19:13 +02:00
ShowShareButtons: true
2020-09-17 10:58:09 +02:00
```
---
2020-10-06 09:31:20 +02:00
### Show post reading time
2020-09-17 10:58:09 +02:00
Displays Reading Time (the estimated time, in minutes, it takes to read the content.)
To show reading time add
2020-10-27 14:16:08 +01:00
2020-09-17 10:58:09 +02:00
```yml
Params:
2022-06-10 18:19:13 +02:00
ShowReadingTime: true
2020-09-17 10:58:09 +02:00
```
---
2020-10-06 09:31:20 +02:00
### Show Table of Contents (Toc) on blog post
2020-09-17 10:58:09 +02:00
Displays ToC on blog-pages
To show ToC add following to page-variables
2020-10-27 14:16:08 +01:00
2020-09-17 10:58:09 +02:00
```yml
ShowToc: true
```
2020-09-24 08:24:04 +02:00
To keep Toc Open **by default** on a post add following to page-variables:
2020-10-27 14:16:08 +01:00
2020-09-24 07:48:03 +02:00
```yml
TocOpen: true
```
2020-09-17 10:58:09 +02:00
---
2021-02-01 06:47:12 +01:00
### BreadCrumb Navigation
Adds BreadCrumb Navigation above Post's Title to show subsections and Navigation to Home
```yml
params:
2022-06-10 18:19:13 +02:00
ShowBreadCrumbs: true
2021-02-01 06:47:12 +01:00
```
Can be diabled for particular page's front-matter
```yml
---
ShowBreadCrumbs: false
---
```
2021-02-07 17:25:52 +01:00
---
2021-03-28 06:35:47 +02:00
### Edit Link for Posts
Add a button to suggest changes by using the file path of the post to link to a edit destination.
For site config use:
```yml
Params:
2022-06-10 18:19:13 +02:00
editPost:
URL: "https://github.com/< path_to_repo > /content"
Text: "Suggest Changes" # edit text
appendFilePath: true # to append file path to Edit link
2021-03-28 06:35:47 +02:00
```
Can be modified for individual pages
```yml
---
editPost:
2022-06-10 18:19:13 +02:00
URL: "https://github.com/< path_to_repo > /content"
Text: "Suggest Changes" # edit text
appendFilePath: true # to append file path to Edit link
2021-03-28 06:35:47 +02:00
---
```
The example above would yield the following link for the post file `posts/post-name.md` :
2023-12-15 17:22:06 +01:00
`https://github.com/<path_to_repo>/content/posts/post-name.md`
2021-03-28 06:35:47 +02:00
2023-12-15 17:22:06 +01:00
| Parameter | Required | Default Value |
| ------------------------- | -------- | ------------- |
| `editPost.URL` | true | - |
| `editPost.appendFilePath` | false | `false` |
| `editPost.Text` | false | `Edit` |
2021-03-28 06:35:47 +02:00
Since the link generated is a regular HTML anchor tag `<a href=...>` , you can
also use other URL schemas like `mailto://` , e.g.
`URL: "mailto://mail@example.com?subject=Suggesting changes for "`
---
2021-02-01 06:47:12 +01:00
### Other Posts suggestion below a post
Adds a Previous / Next post suggestion under a single post
```yml
params:
2022-06-10 18:19:13 +02:00
ShowPostNavLinks: true
```
---
### Code Copy Button
Adds a `copy` button in code block to copy the code it contains
```yml
params:
ShowCodeCopyButtons: true
2021-02-01 06:47:12 +01:00
```
2021-02-07 17:25:52 +01:00
---
2020-10-25 08:48:45 +01:00
### Multiple Authors
To Use multiple authors for a post, in post-variables:
```yml
---
author: ["Me", "You"]
---
```
To use Multiple Authors Site-wide, in `config.yml` :
```yml
params:
2022-06-10 18:19:13 +02:00
author: ["Me", "You"]
2020-10-25 08:48:45 +01:00
```
---
2020-10-06 09:31:20 +02:00
### Comments
2020-09-17 10:58:09 +02:00
to add comments, create a html file
`layouts/partials/comments.html`
and paste code provided by your comments provider
also in config add this
2020-09-24 08:24:04 +02:00
2020-09-17 10:58:09 +02:00
```yml
params:
2022-06-10 18:19:13 +02:00
comments: true
2020-09-17 10:58:09 +02:00
```
2021-01-17 08:09:12 +01:00
read more about this [hugo-comments ](https://gohugo.io/content-management/comments/ )
2020-09-17 10:58:09 +02:00
---
2021-01-13 16:02:37 +01:00
### AccessKeys
```text
c - ToC Open/Close
g - Go To Top
h - Home (according to current lang)
t - Theme toggle
/ - Jumps to search page if in menu
```
[What's AccessKeys ? ](https://www.w3schools.com/tags/att_global_accesskey.asp )
---
### Enhanced SEO
2021-01-15 20:20:21 +01:00
**Enabled only when `env: production` **
2021-01-13 16:02:37 +01:00
2022-06-10 18:19:13 +02:00
- [Rich Results/Snippets Support ](https://support.google.com/webmasters/answer/7506797?hl=en )
2021-01-13 16:02:37 +01:00
2021-08-22 08:24:20 +02:00
#### Twitter Cards Support
2023-12-15 17:22:06 +01:00
- The Twitter Cards metadata, except `twitter:image` should not require
2021-08-22 08:24:20 +02:00
additional configuration, since it is generated from metadata that
you should already have (for instance the page title and description).
2023-12-15 17:22:06 +01:00
- The `twitter:image` uses the [Post Cover Image ](#post-cover-image ), if present.
- In the absence of a cover images, the first image from the `images`
2021-08-22 08:24:20 +02:00
frontmatter (a list) is used.
```yaml
images:
- image_01.png
- image_02.png
```
2023-12-15 17:22:06 +01:00
- Finally, if neither of those are provided, `twitter:image` comes from the first
2021-08-22 08:24:20 +02:00
[Page Bundle ](https://gohugo.io/content-management/page-bundles/ )
2023-12-15 17:22:06 +01:00
image with `feature` in the name, with a fallback to the first image with
`cover` or `thumbnail` in the name.
2021-08-22 08:24:20 +02:00
#### OpenGraph support
2023-12-15 17:22:06 +01:00
- The OpenGraph metadata, except `og:image` should not require
2021-08-22 08:24:20 +02:00
additional configuration, since it is generated from metadata that
you should already have (for instance the page title and description).
2023-12-15 17:22:06 +01:00
- The `og:image` uses the [Post Cover Image ](#post-cover-image ), if present.
- In the absence of a cover images, the first image from the `images`
2021-08-22 08:24:20 +02:00
frontmatter (a list) is used.
```yaml
images:
- image_01.png
- image_02.png
```
2023-12-15 17:22:06 +01:00
- Finally, if neither of those are provided, `og:image` comes from the first
2021-08-22 08:24:20 +02:00
[Page Bundle ](https://gohugo.io/content-management/page-bundles/ )
2023-12-15 17:22:06 +01:00
image with `feature` in the name, with a fallback to the first image with
`cover` or `thumbnail` in the name.
- For pages, you can also add audio (using frontmatter `audio: filename.ext` ) and/or
2021-08-22 08:24:20 +02:00
videos.
```yaml
videos:
- filename01.mov
- filename02.avi
```
2023-12-15 17:22:06 +01:00
2021-01-13 16:02:37 +01:00
---
### Multilingual Support
---
2020-10-06 09:31:20 +02:00
### Misc
2020-09-17 10:58:09 +02:00
2020-10-06 09:31:20 +02:00
#### Scroll-Bar themed (by default)
#### Smooth Scroll between in-page links (by default)
#### Scroll-to-Top Button (by default)
2021-01-13 16:02:37 +01:00
```text
2020-10-06 09:31:20 +02:00
Displays a Scroll-to-Top button in right-bottom corner
2021-01-13 16:02:37 +01:00
```
2020-10-06 09:31:20 +02:00
#### Google Analytics integration
#### Syntax highlighting
#### RSS feeds