Site Logo
Kayal
Cover Image

Configuration πŸ”©

Posted on 7 mins

Kayal Config

The config files that included with Kayal contain all of the possible settings that the theme recognises. By default, many of these are commented out but you can simply uncomment them to activate or change a specific configuration.

The configuration files are provided in TOML format, which is the default syntax used by Hugo. Feel free to convert to YAML or JSON if you wish.

As outlined in the installation instructions, you should adjust your theme configuration by modifying the files in the config/_default/ folder of your Hugo project and delete the hugo.toml file in your project root.

Basic Site Configuration

The site configuration is managed through the config/_default/hugo.toml file. The following outlines all of the settings that Kayal expects to function properly.

Note: the variable names provided in this table use dot notation to simplify the TOML data structure ie. outputs.home refers to

[outputs]
    home = ...
NameDefaultDescription
theme"kayal"The theme to use. Should be set to "kayal" for the theme to work.
Required if you didn’t use Hugo Modules to install Kayal.
baseURLNot SetRequired The URL to the root of the website.
languageCodeen-usLanguage ISO 639 code for your site.
titleNot SetRequired: The site’s title.
pagination.pagerSize5The number of articles listed on each page of the article listing.
enableEmojitrueEnables emoji processing in markdown.
enableRobotsTXTtrueEnables the creation of a robots.txt file, which allows search engines to crawl your site.
summaryLength0Number of words for auto-generating an article summary if not provided in the front matter. A value of 0 uses the first sentence.
buildDraftstrueIncludes pages with draft status while building the site.
buildFuturetrueIncludes pages with future dates while building the site.
services.googleAnalyticsNot SetUsed to enable Google Analytics service. Check here for more details.
outputs.home["HTML", "RSS", "JSON"]The types of outputs to generate for the homepage. RSS is required to create RSS feeds, and JSON is needed for the search functionality.
Kayal requires all 3 to be enabled.

You can find the hugo.toml config file for this site here for reference.

Menus appear at the top of the header on your page. Menu configuration is managed through config/_default/menus.toml file as a toml list.

Each menu entry in the toml list includes:

NameDescription
nameUnique Identifier
titleDisplayed text
urlLink destination for the menu item.
pre(Optional) Icon name to be used. All available icons are listed here .
weightDetermines the position within the menu. Items with lighter weights appear higher or first

Here’s menu config file for this site.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
[[main]]
name = "Docs"
title = "Docs"
url = "/docs/"
weight = 1

[[main]]
name = "Examples"
title = "Examples"
url = "/examples/"
weight = 2

[[main]]
name = "Shortcodes"
title = "Shortcodes"
url = "/docs/shortcodes/"
weight = 3

[[main]]
name = "GitHub"
title = ""
pre = "github"
url = "https://github.com/mnjm/kayal"
weight = 4

Add a trailing / to local URLs. For example /posts/ (not /posts). This is required for highlightCurrentMenu to work.

Also new icons can be added, Check Icons Section in Advanced Customization

Theme Parameters

Kayal provides large number of configuration options to fit and suite your needs. These configurations are managed through config/_default/params.toml.

You can find the params.toml config file for this site here for reference.

Global

NameDefaultDescription
logoNot setOptional: Path to the site logo image located in the assets/ folder in your site’s root.
Displayed before the Site Title in the header. Minimum size: 64x64px.
description"A Hugo Theme"Site’s description. This will be used by search engines when listing your site.
copyrightNot setOptional: Copyright owner’s name.
optimizeImgtrueWhether to optimize images per view port scales.
enableCodeCopytrueWhether to enable the copy button in code blocks.
showThemeSwitchertrueShow the icon that switches between dark and light themes when clicked.
defaultTheme"auto"Default theme to start from. Valid options: "light", "dark", "auto".
If "auto", Kayal will detect the previous preference. If no previous preference is found, Kayal will use the browser’s preference.
highlightCurrentMenutrueWhen enabled, highlights the current menu item in the menu bar.
mainSections["posts"]The sections to display in the recent articles list. If not provided, the section with the most articles is used.
removeAttributionfalseWhether to remove Hugo and theme attribution in the footer.
showHeadingAnchorstrueWhether to show anchor links in headings. Can be overridden by Page-specific showHeadingAnchors in its front matter.
enableSearchtrueWhether to enable search functionality. JSON homepage output is required for this to function. Check site config .

Homepage

NameDefaultDescription
showRecenttrueWhether to display recent items on the homepage.
showRecentLabel"Featured"Label for the heading of recent items.
showRecentItems4Number of recent items to display.
showMoretrueWhether to show a “Show more” link at the end of the recent items section.
showMoreDest"/posts"Destination URL for the “Show more” link.
The content for the homepage page is read from content/_index.md.

By default Kayal uses a profile layout for homepage. You can override this by providing a layout html file in your site’s layout/partials/homepage.html. Check here for more info.

Profile settings

NameDefaultDescription
headlineNot setOptional: A brief, one-line intro displayed at the top of your profile.
imageNot setOptional: Path to the profile image located in the assets/ folder in your site’s root. Minimum size: 200x200px.
where"right"Position of the image. Valid options: "right", "left", "top".

Article Settings

NameDefaultDescription
showDatetrueWhether to display the published date in the article.
showModDatetrueWhether to display the modified date in the article.
showReadingTimetrueWhether to display the estimated reading time in the article.
showTagstrueWhether to display tags mentioned in the front matter.
showPaginationtrueWhether to display next/previous article links in the article footer.
invertPaginationtrueWhether to reverse the direction of next/previous article links.
showToCtrueWhether to display the table of contents on article pages.
openToCfalseWhether to automatically open the Table of Contents when the page is loaded.
showCommentsfalseWhether to display comments. Check Comments for more details.
showBreadcrumbsfalseWhether to display breadcrumbs in the article.

These settings can be overridden by the page’s front matter using the same names. For example, if you don’t want to display the ToC on a specific page, you can add showToC: false to its front matter, as shown below:

---
title: 'Example'
date: 2024-07-21T21:28:49+05:30
showToC: false
---
<!-- Markdown content -->

Additionally, a few extra front matter parameters are available:

NameDescription
coverImgThe cover image for the article. This will be displayed at the top of the article page. This should be served as page resouce. Refer here
hiddenWhen set to true, this hides the page from appearing in the recent homepage section.
externalURLLinks to third-party published pages as list entries. Specifying a URL prevents generating a content page and directly links to the third-party website.

List template settings

NameDefaultDescription
groupByYearfalseWhether to group articles by year.
showBreadcrumbsfalseWhether to display breadcrumbs.
cardViewtrueWhether to display pages in a card view.
showRSSfalseWhether to display RSS link.

These settings can be overridden by page’s front matter (in _index.md files for lists) with the same name.

Taxonomy and Term Settings

Taxonomy settings

NameDefaultDescription
showCounttrueWhether to display counts for each taxonomy term.
cardViewtrueWhether to display taxonomies as a grid of cards.

Term settings

NameDefaultDescription
groupByYearfalseWhether to group articles by year.
showBreadcrumbsfalseWhether to display breadcrumbs.
cardViewtrueWhether to display pages in a card view.
showRSSfalseWhether to display RSS link.

Social links are configured as a TOML list, with each entry containing:

NameDefaultDescription
nameUnique IdentifierThe unique identifier for the social link.
iconIcon nameThe icon name. All available icons are listed here .
urlLink destinationThe URL for the social media link.

Example:

1
2
3
4
5
6
7
8
9
[[social]]
name = "LinkedIn"
icon = "linkedin"
url = "https://linkedin.com"

[[social]]
name = "Email"
icon = "email"
url = "mailto:name@example.com"

Also, New icons can be added. Check the Icons Section in the Advanced Customization documentation.

Favicons

Place favicon assets in the static folder of your site (mywebsite/static). Use the filenames listed below. If you use favicon.io , it will automatically generate these filenames for you.

static/
β”œβ”€β”€ android-chrome-192x192.png
β”œβ”€β”€ android-chrome-512x512.png
β”œβ”€β”€ apple-touch-icon.png
β”œβ”€β”€ favicon-16x16.png
β”œβ”€β”€ favicon-32x32.png
β”œβ”€β”€ favicon.ico
└── site.webmanifest

To override the default favicon inclusion, see Overriding Favicons .