Fork Mainroad

This commit is contained in:
Greg Hellings
2024-04-22 01:38:32 -05:00
parent 45efd643e9
commit 1daa5edd31
102 changed files with 10349 additions and 1 deletions
@@ -0,0 +1,4 @@
---
title: Documentation
description: Mainroad theme documentation, including getting started, customization guides, and FAQ.
---
@@ -0,0 +1,269 @@
---
title: Customization
description: Describes common Mainroad theme configuration parameters that can be adjusted via config file or via Front
Matter section.
lead: Describes common Mainroad theme configuration parameters that can be adjusted via config file or via Front Matter
section.
date: 2022-01-24T14:00:00.000Z
thumbnail:
src: "img/placeholder.png"
visibility:
- list
authorbox: false
sidebar: false
pager: false
weight: 2
menu: main
---
Customization page describes common Mainroad configuration parameters which can be specified via configuration file or
via Front Matter section. That includes logo section tuning, adding a sidebar with widgets, adjusting highlight color,
and more.
<!--more-->
This section will mainly cover customization settings that are unique to this theme. If something is not covered here,
there's a good chance it is covered somewhere in [Hugo docs](https://gohugo.io/documentation/).
### Logo
**Mainroad** allows you to set a custom logo in the site header. You may use text, or image, or both. Use the following
options in your site config:
```toml
[Params.logo]
image = "img/placeholder.png"
title = "Mainroad"
subtitle = "Just another site"
```
**Note:** logo image will display at a maximum width of 128 pixels and a maximum height of 128 pixels
when you use text and image simultaneously. When the only logo image is active, it will display at a maximum height of
256 pixels. Ideally, your logo image should be SVG.
---
If you don't set any of these variables, the theme uses the site title as a logo title. Don't need a logo section?
Disable it this way:
```toml
[Params.logo]
image = false
title = false
subtitle = false
```
### Highlight color
Mainroad uses `#e22d30` as a default highlight color, but you may choose and set any other color.
```toml
[Params.style.vars]
highlightColor = "#e22d30"
```
### Thumbnail visibility
By default, a thumbnail image has shown for a list and single pages simultaneously. In some cases, you may want to show
a thumbnail for list-like pages only and hide it on single pages (or vice versa). Control global thumbnail visibility
via config, use the key `visibility` with combination of valid values `"list"` and `"post"`.
```toml
[Params.thumbnail]
# Show thumbnail only for list items
visibility = ["list"]
```
Besides global configuration, you can change thumbnail visibility individually with extended thumbnail notation via
front matter block.
```yaml
thumbnail:
src: "img/placeholder.png"
visibility:
- list
- post
```
This page is an example of list-only thumbnail visibility.
### Sidebar
**Mainroad** comes with a configurable sidebar that can be on the left, on the right, or disabled. The default layout
can be specified in the `[Params.sidebar]` section of the configuration. The position can be specified for home, list
and single pages individually. Use the keys `home`, `list` and `single` with values `"left"`, `"right"` or `false`.
```toml
[Params.sidebar]
home = "right"
list = "right"
single = "right"
```
The layout can be configured per page, by setting the `sidebar` parameter with one of the same values (`"left"`,
`"right"` or `false`) in the page's front matter.
```yaml
sidebar: "left" # Enable sidebar (on the left side) per page
```
The sidebar consists of multiple widgets. Widgets can be enabled individually using the `widgets` key with a list of
widget names as value. You can add your own widgets, by placing a template under `layouts/partials/widgets/<name>.html`.
```toml
[Params.sidebar]
# Enable widgets in given order
widgets = ["search", "recent", "categories", "taglist", "social", "languages"]
```
The list of widgets can be overwritten from a page's front matter.
```yaml
# Enable sidebar widgets in given order
widgets:
- "search"
- "recent"
- "taglist"
```
Full list of available default widgets:
* `search`, `ddg-search`, `recent`, `categories`, `taglist`, `social`, `languages`
---
Some of our widgets respect optional configuration. Have a look at the `[Params.widgets]` and `[Params.widgets.social]`
sections in the example below.
```toml
[Params.widgets]
recent_num = 5 # Set the number of articles in the "Recent articles" widget
categories_counter = false # Enable counter for each category in "Categories" widget
tags_counter = false # Enable counter for each tag in "Tags" widget
```
```toml
[Params.widgets.social]
# Enable parts of social widget
facebook = "username"
twitter = "username"
instagram = "username"
linkedin = "username"
telegram = "username"
github = "username"
gitlab = "username"
bitbucket = "username"
email = "example@example.com"
```
### Social Widget: custom links
**Mainroad** contains built-in social links in the social widget. In addition to default social links, you may set
custom links by adding `Params.widgets.social.custom` to your `config.toml`. Here is an example:
```toml
[[Params.widgets.social.custom]]
title = "My Home Page"
url = "https://example.com"
```
If you want to display an icon of your social link, you need to put SVG icon file in `layouts/partials` directory under
your site's root. The `icon` key filed, which is optional, should be a path relative to `layouts/partials`.
```toml
[[Params.widgets.social.custom]]
title = "Youtube"
url = "https://youtube.com/user/username"
icon = "youtube.svg"
```
**Note:** *Only* SVG files are supported to be used as custom social icons. If you use any other files, PNG for example,
a compile error will be raised by Hugo. Moreover, not every SVG icon can be used. For better results, it should be
one-color SVG file with a special class attribute `{{ with .class }}{{ . }} {{ end }}` and 24x24 size. At a minimum,
custom SVG icon needs these attributes:
```html
<svg class="{{ with .class }}{{ . }} {{ end }} icon" width="24" height="24">...</svg>
```
### Menus
**Mainroad** supports multiple menus. The `main` menu is fully responsive and displayed right under the site header. The
secondary menus `side` and `footer` are displayed in a sidebar widget and the page footer respectively. To add a page to
a menu, add a `menu: <menu>` parameter to the page's front matter:
```yaml
menu: main # Add page to a main menu
```
**Note:** Don't forget to enable the `sidemenu` widget in the `widgets` configuration param if you want to use the
`side` menu.
---
You can also add a page to multiple menus by providing a list:
```yaml
# Add page to a main, side, and footer menu
menu:
- main
- side
- footer
```
**Note:** Please keep in mind that Mainroad menus don't support nested items i.e. submenus.
See [Menus](https://gohugo.io/content-management/menus/#readout) from official Hugo documentation for more info.
### Custom Google Fonts support
Mainroad uses Open Sans from Google Fonts as a main font. But you can use any other font from Google Fonts if you'd
like. Beware, in most cases, such changes require manual CSS adjustment because every set of fonts is different and
might not look as good as our default font.
Follow the procedure below.
1. Open Google Fonts, choose font(s) that you prefer and copy href font link. For this particular example, we choose
[Roboto with 3 different styles](https://fonts.google.com/share?selection.family=Roboto:ital,wght@0,400;0,700;1,400;1,700).
Our href font link:
```
https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,400;0,700;1,400&display=swap
```
1. Set `googleFontsLink` site's config param value to your href font link. For example:
```toml
[Params]
googleFontsLink = "https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,400;0,700;1,400&display=swap"
```
1. Override default font-family set(s):
```toml
[Params.style.vars]
fontFamilyPrimary = "'Roboto', sans-serif"
```
---
It is possible to disable Google Fonts and use system font stack instead.
1. Disable Google Fonts include. Set `googleFontsLink` site's config param value to `false`:
```toml
[Params]
googleFontsLink = false
```
1. Override font-family sets:
```toml
[Params.style.vars]
# Override font-family sets. Take care of different quotes OR escaping symbols in these params if necessary
fontFamilyPrimary = "system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', 'Liberation Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'"
# Secondary font-family set responsible for pre, code, kbd, and samp tags font
fontFamilySecondary = "SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace"
```
[Edit this page on GitHub](https://github.com/vimux/mainroad/blob/master/exampleSite/content/docs/customization.md)
@@ -0,0 +1,85 @@
---
title: Frequently asked questions (FAQ)
description: Browse this FAQ page to find answers to frequently asked questions that have not been covered elsewhere in
the documentation.
date: 2022-01-24T14:00:00.000Z
authorbox: false
sidebar: false
pager: false
weight: 3
menu:
main:
name: FAQ
---
Browse this FAQ page to find a collection of answers to frequently asked questions that have not been covered elsewhere
in the documentation.
<!--more-->
The answers have been categorized into two groups. Those are answers to general questions without any lines of code, and
those are answers to technical questions with code snippets, step-by-step instructions, etc.
## General questions
### Do I need to have some prior experience before proceed with Mainroad theme?
**Yes.** We expect that you already have prior experience with Hugo, at least.
[Our docs section]({{< ref "/docs/_index.md" >}} "Mainroad theme documentation") is for intermediate users and
developers, not novice users with zero or minimal experience. Still, all documentation pages would be helpful even if
you don't have such experience. Just don't expect all your typical questions answered here.
### Do I need to use the extended version of Hugo?
**No.** Mainroad theme intentionally does not use any features of the extended version. As such, the extended version of
Hugo is not required (but applicable).
### Is there a list of all possible configuration options?
**Configuration:**
* See [All Configuration Settings](https://gohugo.io/getting-started/configuration/#all-configuration-settings) section
for the full list of Hugo-defined variables with their default value.
* See [Mainroad config.toml example](https://github.com/Vimux/Mainroad#configtoml-example) for the full list of
Mainroad-specific variables.
**Front Matter:**
* See [Front Matter Variables](https://gohugo.io/content-management/front-matter#front-matter-variables) section for the
list of Hugo-defined Front Matter variables.
* See [Mainroad Front Matter example](https://github.com/Vimux/Mainroad#front-matter-example) section for the list of
Mainroad-specific Front Matter variables.
### What if I have more questions? May I should create an issue?
**We don't provide free personal technical support.** As stated in
[CONTRIBUTING](https://github.com/Vimux/Mainroad/blob/master/CONTRIBUTING.md), please do not use the issue tracker for
personal support. This includes any reports like “how to do this or that”; “everything broken, help me”; “I changed
something, it doesn't work anymore”; “It's not a personal issue, I just want to ask how X or Y works”; “I forked your
theme, then something broken, fix this immediately” and so on. **The issue tracker is the preferred channel for bug
reports, feature requests, and discussions that comply with our contributing rules**, nothing more. All other issues
would be closed and marked as invalid.
## Technical questions
**I wanted to get the `favicon.ico` and `apple-touch-icon.png` to match my `hightlightColor`, what should I do?**
There is no way to do this on the fly with Hugo, but you may use two one-liners below with some preparations:
1. Copy:
* `./themes/mainroad/favicon.ico` to `./static/favicon.ico`
* `./themes/mainroad/apple-touch-icon.png` to `./static/apple-touch-icon.png`
1. Replace the color in variable to your preferred at the beginning of both scripts. Beware, you should use full
six-digit Hex triplet notation (e.g., `#E22D30`) to make it work properly.
Go to the root of your project directory in the terminal and execute this two commands accordingly.
```
a=#E22D30;a=\\x${a:5:2}\\x${a:3:2}\\x${a:1:2};for i in 98 274 578;do printf $a|dd of=static/favicon.ico bs=1 seek=$i conv=notrunc;done
```
```
a=#E22D30;a=$(echo 504C54452A2A2A${a:1:6}|sed -e 's/../\\x&/g');printf $a|gzip|tail -c8|od -tx4 -N4 -An|xargs|sed -e 's/../\\x&/g'|printf $a$(cat -)|dd of=static/apple-touch-icon.png bs=1 seek=37 conv=notrunc
```
[Edit this page on GitHub](https://github.com/vimux/mainroad/blob/master/exampleSite/content/docs/faq.md)
@@ -0,0 +1,89 @@
---
title: Getting started
description: This article helps you get started with the Mainroad theme, including installation and minimal
configuration.
lead: This article helps you get started with the Mainroad theme, including installation and minimal configuration.
date: 2022-01-24T14:00:00.000Z
tags:
- "Installation"
authorbox: false
sidebar: false
pager: false
weight: 1
menu: main
---
Welcome to the Mainroad theme documentation. This quick guide has been written for intermediate and advanced users who
are interested in getting started with the Mainroad theme, including installation and minimal configuration. To fully
understand the rest of this guide, you need to be familiar with the main concepts of the [Hugo](https://gohugo.io/)
static site generator.
<!--more-->
## Installation
To begin with **Mainroad** theme, you should have
[**Hugo** (version 0.48 or later) installed](https://gohugo.io/getting-started/quick-start/#step-1-install-hugo) and
[create a new site](https://gohugo.io/getting-started/quick-start/#step-2-create-a-new-site). For comprehensive Hugo
installation guide, please visit [Hugo Documentation](https://gohugo.io/getting-started/installing/). After that, you
are ready to install Mainroad theme.
There are a few options to install a theme in Hugo. This can be done via git submodule, git clone, Hugo modules, or even
by downloading the archive and manually copying the files. Use what you know and what works best for you. Three
installation options are described below.
### Option A: `git submodule`
*Additional requirements: git*
If you don't plan to make any significant changes but want to track and update the theme, you can add it as a [git
submodule](https://git-scm.com/docs/git-submodule) by running the following command from the root directory of your Hugo
site:
```sh
git submodule add https://github.com/vimux/mainroad.git themes/mainroad
```
**Note:**
[Netlify expects git submodule](https://docs.netlify.com/configure-builds/common-configurations/hugo/#hugo-themes)
instead of git clone.
### Option B: `git clone`
*Additional requirements: git*
Run this [git clone](https://git-scm.com/docs/git-clone) command from the root of your Hugo site:
```sh
git clone https://github.com/vimux/mainroad.git themes/mainroad
```
### Option C: Manual install
If you do not want to use git for some reason, you can manually
**[download ZIP](https://github.com/vimux/mainroad/archive/master.zip)** and extract it into the `themes/mainroad`
within your Hugo site.
---
### Activate theme
No matter what option do you choose above, don't forget to edit `theme` param of the site configuration `config.toml`:
```toml
theme = "mainroad"
```
Done. Build the site via `hugo` command or make it available on a local server via `hugo server` to check it out.
## Minimal configuration
**We don't recommend copying [example config](https://github.com/vimux/mainroad#configtoml-example) as-is.**
Mainroad theme contains required defaults, so you don't need to add all of configuration parameters to run the
theme for the first time without errors from Hugo. Make sure that you edit the `theme` param inside the config file
and check that theme works. Only then start to add theme-specific parameters that you really need.
[Customization page]({{< relref "/docs/customization.md" >}} "Mainroad theme customization") describes common settings
that you may want to change and our [demo config](https://github.com/vimux/mainroad/blob/master/exampleSite/config.toml)
could help with configuration too.
[Edit this page on GitHub](https://github.com/vimux/mainroad/blob/master/exampleSite/content/docs/getting-started.md)