Contents

Theme Documentation - Basics

Discover what the Hugo - LoveIt theme is all about and the core-concepts behind it.

1 Requirements

Install the latest edition of  Hugo for your OS (Windows, Linux, macOS). The theme ships its styles compiled, so Dart Sass is needed only when you customize the styles or use the style shortcode.

To install the theme as a Hugo Module, the recommended way, also install Go and Git.

LoveIt 0.4.X requires Hugo 0.146.0 or later

LoveIt NEW | 0.4.0

LoveIt 0.4.X requires Hugo 0.146.0 or later. When the theme compiles its styles, it does so with Dart Sass: install it next to Hugo, as the extended edition of Hugo is not enough, and Hugo 0.170.0 no longer ships one. LoveIt CHANGED | 0.4.3 A site that keeps the theme styles builds without Dart Sass.

If you are upgrading from LoveIt 0.3.X, read Upgrade from 0.3.X first.

2 Installation

The following steps are here to help you initialize your new website. If you don’t know Hugo at all, we strongly suggest you learn more about it by following this great documentation for beginners.

2.1 Create Your Project

Hugo provides a new command to create a new website:

hugo new site my_website
cd my_website

2.2 Install the Theme

The LoveIt theme’s repository is: https://github.com/dillonzq/LoveIt.

Install a released version of the theme, as each method below does. The release branch always points to the latest release. The master branch is where the theme is developed, so it may contain unreleased and unstable changes. To upgrade the theme later, see Upgrade the Theme.

2.2.1 Hugo Module (Recommended)

With Hugo Modules, Hugo downloads the theme itself and records its version in go.mod, so you do not keep a copy of the theme in your site. This needs Go and Git. Make your site a Hugo Module with any module path, such as the path of your repository, then get the theme. Hugo picks its latest release:

hugo mod init github.com/username/my_website
hugo mod get github.com/dillonzq/LoveIt

Commit go.mod and go.sum with your site. The basic configuration below uses the theme with theme = "github.com/dillonzq/LoveIt".

The following methods put the theme in the themes/LoveIt directory instead. With them, set theme = "LoveIt" in the basic configuration.

2.2.2 Git Submodule

Make your site directory a Git repository and add the release branch of the theme as a submodule:

git init
git submodule add -b release https://github.com/dillonzq/LoveIt.git themes/LoveIt

Your site repository records the version of the theme, and -b release lets you upgrade it to the next release.

2.2.3 Release .zip File

Open the latest release of the theme and download its  Source code (zip). The archive extracts to a LoveIt-x.y.z directory (x.y.z is the version): move it to the themes directory and rename it to LoveIt, so that the theme files are directly in themes/LoveIt.

2.2.4 Git Clone

Or, clone the release branch of this repository to the themes directory:

git clone -b release https://github.com/dillonzq/LoveIt.git themes/LoveIt
Deploying from a Git repository

Build services such as Netlify, Vercel, Cloudflare Pages and GitHub Actions build from your site’s repository, so the theme must be in it as a Hugo Module, a submodule or the committed files of a release .zip, as above. A Hugo Module also needs Go on the build service. If you git clone the theme into themes/ inside your site repository and commit it, Git records only a reference to the nested repository, not its files. The site then builds on your computer but not on the service, which reports errors such as template for shortcode "typeit" not found or found no layout file for "html" for kind "home". If you have already committed such a clone, switch it to the release branch and turn it into a submodule (git submodule add reuses the existing clone and records the commit it has checked out):

git -C themes/LoveIt fetch origin
git -C themes/LoveIt checkout -B release origin/release
git rm --cached themes/LoveIt
git submodule add -b release https://github.com/dillonzq/LoveIt.git themes/LoveIt
git commit -m "Add LoveIt as a submodule"

If you changed the theme in that clone, push your commits to a fork and use the fork’s URL instead: a build service can only fetch commits that exist in the submodule’s repository.

With GitHub Actions, check out the submodules too (submodules: true for actions/checkout). Also set the Hugo version the service uses (for example the HUGO_VERSION environment variable on Netlify and Vercel) to one this theme supports: older Hugo versions report the same found no layout file warnings.

LoveIt theme's compatibility
LoveIt branch or versionSupported Hugo versions
master(Unstable)≥ 0.146.0
0.4.X(Recommended)≥ 0.146.0
0.3.X0.128.0 - 0.145.0
0.2.X(Outdated)0.68.0 - 0.127.0

2.3 Basic Configuration

The following is a basic configuration for the LoveIt theme:

baseURL = "http://example.org/"

# Change the default theme to be used when building the site with Hugo
# the module path of the theme as a Hugo Module, or "LoveIt" for the theme in the "themes/LoveIt" directory
theme = "github.com/dillonzq/LoveIt"

# website title
title = "My New Hugo Site"

# language code ["en", "zh-CN", "fr", "pl", ...]
locale = "en"
# language name ["English", "简体中文", "Français", "Polski", ...]
label = "English"

# Menu config
[menu]
  [[menu.main]]
    weight = 1
    identifier = "posts"
    # you can add extra information before the name (HTML format is supported), such as icons
    pre = ""
    # you can add extra information after the name (HTML format is supported), such as icons
    post = ""
    name = "Posts"
    url = "/posts/"
    # title will be shown when you hover on this menu link
    title = ""
  [[menu.main]]
    weight = 2
    identifier = "tags"
    pre = ""
    post = ""
    name = "Tags"
    url = "/tags/"
    title = ""
  [[menu.main]]
    weight = 3
    identifier = "categories"
    pre = ""
    post = ""
    name = "Categories"
    url = "/categories/"
    title = ""

# Markup related configuration in Hugo
[markup]
  # Syntax Highlighting (https://gohugo.io/content-management/syntax-highlighting)
  [markup.highlight]
    # false is a necessary configuration (https://github.com/dillonzq/LoveIt/issues/158)
    noClasses = false
Note
When building the website, you can set a theme by using --theme option. However, we suggest you modify the configuration file (hugo.toml) and set the theme as the default.

2.4 Create Your First Post

Here is the way to create your first post:

hugo new posts/first_post.md

Feel free to edit the post file by adding some sample content and replacing the title value in the beginning of the file.

Note
By default all posts and pages are created as a draft. If you want to render these pages, remove the property draft: true from the metadata, set the property draft: false or add -D/--buildDrafts parameter to hugo command.

2.5 Launching the Website Locally

Launch by using the following command:

hugo serve

Go to http://localhost:1313.

Basic configuration preview
Basic configuration preview

Tip
When you run hugo serve, when the contents of the files change, the page automatically refreshes with the changes.
Note

Since the theme uses .Scratch in Hugo to implement some features, it is highly recommended that you add --disableFastRender parameter to hugo server command for the live preview of the page you are editing.

hugo serve --disableFastRender

2.6 Build the Website

When your site is ready to deploy, run the following command:

hugo

A public folder will be generated, containing all static content and assets for your website. It can now be deployed on any web server.

Tip
The website can be automatically published and hosted with Netlify, GitHub Pages, AWS Amplify, Render and more. Set up Go on the service for a Hugo Module, and Dart Sass if the site needs it, as these guides describe.

3 Configuration

3.1 Site Configuration

In addition to Hugo global configuration and menu configuration, LoveIt lets you define the following parameters in your site configuration (here is a hugo.toml, whose values are default).

Please open the code block below to view the complete sample configuration :

baseURL = "http://example.org/"

# Change the default theme to be used when building the site with Hugo
# the module path of the theme as a Hugo Module, or "LoveIt" for the theme in the "themes/LoveIt" directory
theme = "github.com/dillonzq/LoveIt"

# website title
title = "My New Hugo Site"

# language code ["en", "zh-CN", "fr", "pl", ...]
locale = "en"
# language name ["English", "简体中文", "Français", "Polski", ...]
label = "English"
# whether to include Chinese/Japanese/Korean
hasCJKLanguage = false

# copyright description used only for seo schema
copyright = ""

# whether to use robots.txt
enableRobotsTXT = true
# whether to use git commit log
enableGitInfo = true
# whether to use emoji code
enableEmoji = true

# Pagination config
[pagination]
  disableAliases = false
  pagerSize = 10
  path = "page"

# Menu config
[menu]
  [[menu.main]]
    weight = 1
    identifier = "posts"
    # you can add extra information before the name (HTML format is supported), such as icons
    pre = ""
    # you can add extra information after the name (HTML format is supported), such as icons
    post = ""
    name = "Posts"
    url = "/posts/"
    # title will be shown when you hover on this menu link
    title = ""
  [[menu.main]]
    weight = 2
    identifier = "tags"
    pre = ""
    post = ""
    name = "Tags"
    url = "/tags/"
    title = ""
  [[menu.main]]
    weight = 3
    identifier = "categories"
    pre = ""
    post = ""
    name = "Categories"
    url = "/categories/"
    title = ""

[params]
  # site default theme ["auto", "light", "dark"]
  defaultTheme = "auto"
  # public git repo url only then enableGitInfo is true
  gitRepo = ""
  # LoveIt NEW | 0.1.1 which hash function used for SRI, when empty, no SRI is used
  # ["sha256", "sha384", "sha512", "md5"]
  fingerprint = ""
  # LoveIt NEW | 0.2.0 date format
  dateFormat = "2006-01-02"
  # website title for Open Graph and Twitter Cards
  title = "My cool site"
  # website description for RSS, SEO, Open Graph and Twitter Cards
  description = "This is my cool site"
  # default images for Open Graph and Twitter Cards when a page has none (path under "static/" or "assets/", or a URL)
  images = []

# Author config
  [params.author]
    name = "xxxx"
    email = ""
    link = ""
    # LoveIt NEW | 0.4.2 author avatar shown in the post meta instead of the user icon (path under "static/" or "assets/", or URL)
    avatar = ""
    # LoveIt NEW | 0.4.3 job title of the author in the structured data (JSON-LD)
    jobTitle = ""
    # LoveIt NEW | 0.4.3 profile URLs of the author in the structured data (JSON-LD), such as GitHub, LinkedIn or Mastodon
    sameAs = []

  # Header config
  [params.header]
    # desktop header mode ["fixed", "normal", "auto"]
    desktopMode = "fixed"
    # mobile header mode ["fixed", "normal", "auto"]
    mobileMode = "auto"
    # LoveIt NEW | 0.2.0 Header title config
    [params.header.title]
      # URL of the LOGO
      logo = ""
      # title name
      name = "My cool site"
      # you can add extra information before the name (HTML format is supported), such as icons
      pre = ""
      # you can add extra information after the name (HTML format is supported), such as icons
      post = ""
      # LoveIt NEW | 0.2.5 whether to use typeit animation for title name
      typeit = false

  # Footer config
  [params.footer]
    enable = true
    # LoveIt NEW | 0.2.0 Custom content (HTML format is supported)
    custom = ''
    # LoveIt NEW | 0.2.0 whether to show Hugo and theme info
    hugo = true
    # LoveIt NEW | 0.2.0 whether to show copyright info
    copyright = true
    # LoveIt NEW | 0.2.0 whether to show the author
    author = true
    # Site creation time
    since = 2022
    # ICP info only in China (HTML format is supported)
    icp = ""
    # license info (HTML format is supported)
    license = ""

  # LoveIt NEW | 0.2.0 Section (all posts) page config
  [params.section]
    # special amount of posts in each section page
    paginate = 20
    # date format (month and day)
    dateFormat = "01-02"
    # amount of RSS pages
    rss = 10

  # LoveIt NEW | 0.2.0 List (category or tag) page config
  [params.list]
    # special amount of posts in each list page
    paginate = 20
    # date format (month and day)
    dateFormat = "01-02"
    # amount of RSS pages
    rss = 10

  # LoveIt NEW | 0.2.0 App icon config
  [params.app]
    # optional site title override for the app when added to an iOS home screen or Android launcher
    title = "My cool site"
    # whether to omit favicon resource links
    noFavicon = false
    # modern SVG favicon to use in place of older style .png and .ico files
    svgFavicon = ""
    # Android browser theme color
    themeColor = "#ffffff"
    # Safari mask icon color
    iconColor = "#5bbad5"
    # Windows v8-11 tile color
    tileColor = "#da532c"

  # LoveIt NEW | 0.2.0 Search config
  [params.search]
    enable = false
    # LoveIt CHANGED | 0.4.3 type of search engine ["fuse", "algolia", "pagefind"] ("lunr" is deprecated)
    type = "fuse"
    # max index length of the chunked content
    contentLength = 4000
    # placeholder of the search bar
    placeholder = ""
    # LoveIt NEW | 0.2.1 max number of results length
    maxResultLength = 10
    # LoveIt NEW | 0.2.3 snippet length of the result
    snippetLength = 30
    # LoveIt NEW | 0.2.1 HTML tag name of the highlight part in results
    highlightTag = "em"
    # LoveIt NEW | 0.2.4 whether to use the absolute URL based on the baseURL in search index
    absoluteURL = false
    [params.search.algolia]
      index = ""
      appID = ""
      searchKey = ""
    # LoveIt NEW | 0.4.0 Fuse.js options
    [params.search.fuse]
      isCaseSensitive = false
      minMatchCharLength = 2
      findAllMatches = false
      location = 0
      threshold = 0.3
      distance = 100
      ignoreLocation = true # LoveIt CHANGED | 0.4.3 match anywhere in the content
    # LoveIt NEW | 0.4.0 Pagefind config
    [params.search.pagefind]
      # directory of the Pagefind index, relative to the baseURL
      basePath = "/_pagefind/"

  # Home page config
  [params.home]
    # LoveIt NEW | 0.2.0 amount of RSS pages
    rss = 10
    # Home page profile
    [params.home.profile]
      enable = true
      # Gravatar Email for preferred avatar in home page
      gravatarEmail = ""
      # URL of avatar shown in home page
      avatarURL = ""
      # LoveIt CHANGED | 0.2.7 title shown in home page (HTML format is supported)
      title = ""
      # subtitle shown in home page (HTML format is supported)
      subtitle = "This is my cool site"
      # whether to use typeit animation for subtitle
      typeit = true
      # LoveIt NEW | 0.4.0 extra text shown below the subtitle, such as a quote or a short summary (HTML format is supported)
      extra = ""
      # LoveIt NEW | 0.4.0 whether to show the extra text in italic
      extraItalic = true
      # whether to show social links
      social = true
      # LoveIt NEW | 0.2.0 disclaimer (HTML format is supported)
      disclaimer = ""
    # Home page posts
    [params.home.posts]
      enable = true
      # special amount of posts in each home posts page
      paginate = 6

  # Social config about the author
  [params.social]
    GitHub = ""
    Linkedin = ""
    X = "" # LoveIt NEW | 0.3.1
    Twitter = "" # LoveIt DEPRECATED | 0.3.1
    Instagram = ""
    Facebook = ""
    Telegram = ""
    Medium = ""
    Gitlab = ""
    Youtubelegacy = ""
    Youtubecustom = ""
    Youtubechannel = ""
    Tumblr = ""
    Quora = ""
    Keybase = ""
    Pinterest = ""
    Reddit = ""
    Codepen = ""
    FreeCodeCamp = ""
    Bitbucket = ""
    Stackoverflow = ""
    Weibo = ""
    Odnoklassniki = ""
    VK = ""
    Flickr = ""
    Xing = ""
    Snapchat = ""
    Soundcloud = ""
    Spotify = ""
    Bandcamp = ""
    Paypal = ""
    Fivehundredpx = ""
    Mix = ""
    Goodreads = ""
    Lastfm = ""
    Foursquare = ""
    Hackernews = ""
    Kickstarter = ""
    Patreon = ""
    Steam = ""
    Twitch = ""
    Strava = ""
    Skype = ""
    Whatsapp = ""
    Zhihu = ""
    Douban = ""
    Angellist = ""
    Slidershare = ""
    Jsfiddle = ""
    Deviantart = ""
    Behance = ""
    Dribbble = ""
    Wordpress = ""
    Vine = ""
    Googlescholar = ""
    Researchgate = ""
    Mastodon = ""
    Thingiverse = ""
    Devto = ""
    Gitea = ""
    XMPP = ""
    Matrix = ""
    Bilibili = ""
    Discord = ""
    DiscordInvite = ""
    Lichess = ""
    ORCID = ""
    Pleroma = ""
    Kaggle = ""
    MediaWiki = ""
    Plume = ""
    HackTheBox = ""
    RootMe = ""
    Malt = "" # LoveIt NEW | 0.3.0
    TikTok = "" # LoveIt NEW | 0.3.0
    TryHackMe = "" # LoveIt NEW | 0.3.0
    Codeberg = "" # LoveIt NEW | 0.3.0
    HuggingFace = "" # LoveIt NEW | 0.3.1
    Threads = "" # LoveIt NEW | 0.3.1
    LeetCode = "" # LoveIt NEW | 0.3.1
    LeetCodeCN = ""
    Bluesky = "" # LoveIt NEW | 0.3.1
    Email = ""
    Phone = ""
    RSS = "" # LoveIt NEW | 0.2.0

  # LoveIt CHANGED | 0.2.0 Page global config
  [params.page]
    # LoveIt NEW | 0.2.0 whether to hide a page from home page
    hiddenFromHomePage = false
    # LoveIt NEW | 0.2.0 whether to hide a page from search results
    hiddenFromSearch = false
    # LoveIt NEW | 0.4.3 whether to ask search engines not to index a page, see "Search Engines and robots.txt" below
    hiddenFromSearchEngines = false
    # LoveIt NEW | 0.2.0 whether to enable twemoji
    twemoji = false
    # whether to enable lightgallery
    lightgallery = false
    # LoveIt NEW | 0.2.0 whether to enable the ruby extended syntax
    ruby = true
    # LoveIt NEW | 0.2.0 whether to enable the fraction extended syntax
    fraction = true
    # LoveIt NEW | 0.2.0 whether to enable the fontawesome extended syntax
    fontawesome = true
    # LoveIt NEW | 0.4.2 when to load the Font Awesome stylesheet and webfonts ["auto", true, false]
    # "auto": only on pages whose content or configured HTML (menu, footer...) uses Font Awesome classes,
    # the theme's own icons are inline SVG; true: always, e.g. for your own layouts that use them; false: never
    fontawesomeCSS = "auto"
    # whether to show link to Raw Markdown content of the content
    linkToMarkdown = true
    # LoveIt NEW | 0.4.3 whether to show "Originally published at" with a link to canonicalURL in the front matter of a post
    linkToCanonical = true
    # LoveIt NEW | 0.2.4 whether to show the full text content in RSS
    rssFullText = false
    # LoveIt NEW | 0.2.0 Table of the contents config
    [params.page.toc]
      # whether to enable the table of the contents
      enable = true
      # LoveIt NEW | 0.2.9 whether to keep the static table of the contents in front of the post
      keepStatic = false
      # whether to make the table of the contents in the sidebar automatically collapsed
      auto = true
    # LoveIt CHANGED | 0.2.0 KaTeX mathematical formulas
    [params.page.math]
      enable = false
      # LoveIt CHANGED | 0.2.11 default inline delimiter is $ ... $ and \( ... \)
      inlineLeftDelimiter = ""
      inlineRightDelimiter = ""
      # LoveIt CHANGED | 0.2.11 default block delimiter is $$ ... $$, \[ ... \], \begin{equation} ... \end{equation} and some other functions
      blockLeftDelimiter = ""
      blockRightDelimiter = ""
      # KaTeX extension copy_tex
      copyTex = true
      # KaTeX extension mhchem
      mhchem = true
    # LoveIt NEW | 0.2.0 Code config
    [params.page.code]
      # whether to show the copy button of the code block
      copy = true
      # the maximum number of lines of displayed code by default
      maxShownLines = 50
      # LoveIt NEW | 0.4.2 whether to show the line numbers of code blocks by default
      # readers can toggle them with a button in the header of a code block
      lineNos = false
      # LoveIt NEW | 0.4.2 whether to wrap the long lines of code blocks by default
      # readers can toggle it with a button in the header of a code block
      wrap = false
    [params.page.code.render]
      # whether to render goat diagrams in code blocks
      goat = true
      # whether to render mermaid diagrams in code blocks
      mermaid = true
    # LoveIt NEW | 0.4.2 Mermaid diagram config
    [params.page.mermaid]
      # renderer of the mermaid code blocks and shortcodes ["pele", "mermaid"]
      # "pele": the lightweight Pele renderer, colors follow the theme without re-rendering,
      # but its layout differs from Mermaid and it has no HTML labels or click callbacks
      # "mermaid": the Mermaid library
      renderer = "pele"
    # LoveIt NEW | 0.2.0 Mapbox GL JS config
    [params.page.mapbox]
      # access token of Mapbox GL JS
      accessToken = ""
      # style for the light theme
      lightStyle = "mapbox://styles/mapbox/light-v10?optimize=true"
      # style for the dark theme
      darkStyle = "mapbox://styles/mapbox/dark-v10?optimize=true"
      # whether to add NavigationControl
      navigation = true
      # whether to add GeolocateControl
      geolocate = true
      # whether to add ScaleControl
      scale = true
      # whether to add FullscreenControl
      fullscreen = true
    # LoveIt NEW | 0.4.0 MetingJS config for the music shortcode
    [params.page.music]
      # Meting API URL, supports :server, :type, :id, :auth and :r placeholders
      api = "https://api.injahow.cn/meting/?server=:server&type=:type&id=:id&r=:r"
    # LoveIt CHANGED | 0.2.0 social share links in post page
    [params.page.share]
      enable = true
      X = true # LoveIt NEW | 0.3.1
      Twitter = false # LoveIt DEPRECATED | 0.3.1
      Threads = true # LoveIt NEW | 0.3.1
      Facebook = true
      Linkedin = false
      Whatsapp = false
      Viber = false
      Pinterest = false
      Tumblr = false
      HackerNews = true
      Reddit = false
      VK = false
      Buffer = false
      Xing = false
      Line = true
      Instapaper = false
      Pocket = false # LoveIt DELETED | 0.4.1
      Flipboard = false
      Weibo = true
      Blogger = false
      Baidu = false # LoveIt DELETED | 0.4.1
      Odnoklassniki = false
      Evernote = false
      Skype = false # LoveIt DELETED | 0.4.1
      Trello = false
      Diaspora = true # LoveIt NEW | 0.3.1
      Mix = false
      Telegram = true # LoveIt NEW | 0.3.1
      Bluesky = false # LoveIt NEW | 0.4.1
      Email = false # LoveIt NEW | 0.4.1
      Douban = false # LoveIt NEW | 0.4.1
      Qzone = false # LoveIt NEW | 0.4.1
      Pinboard = false # LoveIt NEW | 0.4.1
      WordPress = false # LoveIt NEW | 0.4.1
    # LoveIt CHANGED | 0.2.0 Comment config
    [params.page.comment]
      enable = false
      # LoveIt NEW | 0.4.3 the comment system of the pages, see "One comment system per page" below
      # one of "disqus", "gitalk", "valine", "facebook", "telegram", "commento", "utterances",
      # "giscus", "waline", "twikoo", "mastodon", "comentario" and "remark42"; no comments are shown when empty
      # (until 0.5.0, the first comment system with the deprecated enable on is shown)
      type = ""
      # Disqus comment config
      [params.page.comment.disqus]
        # Disqus shortname to use Disqus in posts
        shortname = ""
      # Gitalk comment config
      # clientSecret is published in any page with Gitalk enabled, see "Notes about comment systems" below
      [params.page.comment.gitalk]
        owner = ""
        repo = ""
        clientId = ""
        clientSecret = ""
      # Valine comment config
      # GPL-2.0-only, stores comments in LeanCloud, see "Notes about comment systems" below
      [params.page.comment.valine]
        appId = ""
        appKey = ""
        placeholder = ""
        avatar = "mp"
        meta= ""
        pageSize = 10
        # automatically adapt the current theme i18n configuration when empty
        lang = ""
        visitor = true
        recordIP = true
        highlight = true
        enableQQ = false
        serverURLs = ""
        # LoveIt NEW | 0.2.6 emoji data file name, default is "google.yml"
        # ["apple.yml", "google.yml", "facebook.yml", "twitter.yml"]
        # located in the "assets/lib/valine/emoji/" directory of the theme
        # you can store your own data files in the same path under your project:
        # "assets/lib/valine/emoji/"
        emoji = ""
      # Facebook comment config
      [params.page.comment.facebook]
        width = "100%"
        numPosts = 10
        appId = ""
        # automatically adapt the current theme i18n configuration when empty
        languageCode = ""
      # LoveIt NEW | 0.2.0 Telegram comments config
      [params.page.comment.telegram]
        siteID = ""
        limit = 5
        height = ""
        color = ""
        colorful = true
        dislikes = false
        outlined = false
      # LoveIt NEW | 0.2.0 Commento comment config
      # the hosted Commento script no longer serves Commento, see "Notes about comment systems" below
      [params.page.comment.commento]
      # LoveIt NEW | 0.2.5 utterances comment config
      [params.page.comment.utterances]
        # owner/repo
        repo = ""
        issueTerm = "pathname"
        label = ""
        lightTheme = "github-light"
        darkTheme = "github-dark"
      # giscus comment config (https://giscus.app/)
      [params.page.comment.giscus]
        # You can refer to the official documentation of giscus to use the following configuration.
        repo = ""
        repoId = ""
        category = "Announcements"
        categoryId = ""
        # automatically adapt the current theme i18n configuration when empty
        lang = ""
        mapping = "pathname"
        reactionsEnabled = "1"
        emitMetadata = "0"
        inputPosition = "bottom"
        lazyLoading = false
        lightTheme = "light"
        darkTheme = "dark"
      # LoveIt NEW | 0.3.1 Waline comment config
      # LoveIt CHANGED | 0.4.0 the bundled client is Waline v3, which requires a Waline server v1.27.1 or later
      [params.page.comment.waline]
        serverURL = ""
        # automatically adapt the current theme i18n configuration when empty
        lang = ""
        # emoji presets, the Waline default is used when empty
        emoji = []
        # LoveIt NEW | 0.4.3 show the page views of a post in its post meta, counted by the Waline server
        # page views are looked up by the decoded path of the page, as Valine stored them, so a Waline server
        # that keeps the Counter table of Valine (in LeanCloud, or migrated with the comments) continues its counts
        # where the stored URLs match these paths; a page visited at ".../index.html" is counted under that path,
        # where Valine dropped "index.html"
        pageview = false
        # LoveIt NEW | 0.4.3 show the comment count of a post in its post meta
        comment = false
      # LoveIt NEW | 0.4.3 Twikoo comment config, see "Twikoo comments" below
      [params.page.comment.twikoo]
        # URL of the Twikoo server, or the ID of the Tencent CloudBase environment
        envId = ""
        # region of the Tencent CloudBase environment, such as "ap-guangzhou", the Twikoo default is used when empty
        region = ""
        # automatically adapt the current theme i18n configuration when empty
        lang = ""
      # LoveIt NEW | 0.4.2 Mastodon (Fediverse) comment config, see "Mastodon comments" below
      [params.page.comment.mastodon]
        # URL of the post whose replies are the comments, set it in the front matter of each page
        url = ""
      # LoveIt NEW | 0.4.3 Comentario comment config, see "Comentario comments" below
      [params.page.comment.comentario]
        # URL of your Comentario server, which serves "/comentario.js"
        url = ""
        # the language of the page when empty
        lang = ""
        # deepest level of nested replies, 1 turns nesting off, the Comentario default (10) when 0
        maxLevel = 0
        # update the comments as they are posted
        liveUpdate = true
        # use the fonts of the theme instead of the Comentario font
        noFonts = true
        # URL of a stylesheet that overrides the Comentario styles, or "false" to load no Comentario styles
        cssOverride = ""
      # LoveIt NEW | 0.4.3 Remark42 comment config, see "Remark42 comments" below
      [params.page.comment.remark42]
        # URL of your Remark42 server (its REMARK_URL), which serves "/web/embed.mjs"
        host = ""
        # site ID, the SITE of the server, "remark" (the Remark42 default) when empty
        siteId = ""
        # the language of the page when empty
        locale = ""
        # number of top-level comments shown at first, the Remark42 default when 0
        maxShownComments = 0
        # let readers subscribe to the replies by email
        showEmailSubscription = true
        # let readers subscribe to the comments by RSS
        showRssSubscription = true
        # hide the formatting toolbar and the preview button
        simpleView = false
        # hide the footer with the links to Remark42
        noFooter = false
    # LoveIt NEW | 0.2.7 Third-party library config
    [params.page.library]
      [params.page.library.css]
        # someCSS = "some.css"
        # located in "assets/"
        # Or
        # someCSS = "https://cdn.example.com/some.css"
      [params.page.library.js]
        # someJavascript = "some.js"
        # located in "assets/"
        # Or
        # someJavascript = "https://cdn.example.com/some.js"
    # LoveIt CHANGED | 0.2.10 Page SEO config
    [params.page.seo]
      # image URL
      images = []
      # Publisher info
      [params.page.seo.publisher]
        name = ""
        logoUrl = ""

  # LoveIt NEW | 0.2.5 TypeIt config
  [params.typeit]
    # typing speed between each step (measured in milliseconds)
    speed = 100
    # blinking speed of the cursor (measured in milliseconds)
    cursorSpeed = 1000
    # character used for the cursor (HTML format is supported)
    cursorChar = "|"
    # cursor duration after typing finishing (measured in milliseconds, "-1" means unlimited)
    duration = -1

  # Site verification code config for Google/Bing/Yandex/Pinterest/Baidu
  [params.verification]
    google = ""
    bing = ""
    yandex = ""
    pinterest = ""
    baidu = ""

  # LoveIt NEW | 0.4.0 Security config
  [params.security]
    # Content-Security-Policy meta tag, for when HTTP headers cannot be set
    # https://content-security-policy.com/examples/meta/
    contentSecurityPolicy = ""
    # LoveIt NEW | 0.4.2 referrer policy of the <meta name="referrer"> tag
    # set "no-referrer" to send no Referer header at all
    referrerPolicy = "strict-origin-when-cross-origin"
    # LoveIt NEW | 0.4.2 Mermaid securityLevel ["strict", "loose"], used when params.page.mermaid.renderer is "mermaid"
    # "loose" allows click events and HTML labels in diagrams
    mermaidSecurityLevel = "strict"

  # LoveIt NEW | 0.2.10 Site SEO config
  [params.seo]
    # image URL
    image = ""
    # thumbnail URL
    thumbnailUrl = ""

  # LoveIt NEW | 0.2.0 Analytics config
  [params.analytics]
    # whether to show the GoatCounter page view counter in the post footer (only with goatCounter.code set), not set by default
    enable = false
    # Google Analytics
    [params.analytics.google]
      id = ""
      # LoveIt NEW | 0.3.1 whether to respect the browser’s “do not track” setting
      respectDoNotTrack = false
    # Fathom Analytics
    [params.analytics.fathom]
      id = ""
      # server url for your tracker if you're self hosting
      server = ""
    # Plausible Analytics
    [params.analytics.plausible]
      dataDomain = ""
    # Yandex Metrica
    [params.analytics.yandexMetrica]
      id = ""
    # LoveIt NEW | 0.3.1 GoatCounter Analytics
    [params.analytics.goatCounter]
      # the code of your site, as in https://<code>.goatcounter.com
      code = ""

  # LoveIt NEW | 0.2.7 Cookie consent config
  [params.cookieconsent]
    enable = false
    # text strings used for Cookie consent banner
    [params.cookieconsent.content]
      message = ""
      dismiss = ""
      link = ""

  # LoveIt CHANGED | 0.4.3 CDN config for third-party library files
  [params.cdn]
    # CDN data file name, default is "" (serve the library files bundled with the theme)
    # ["jsdelivr.yml", "jsdelivr.fastly.yml", "jsdelivr.cloudflare.yml", "unpkg.yml"]
    # located in the "assets/data/cdn/" directory of the theme
    # you can store your own data files in the same path under your project:
    # "assets/data/cdn/"
    data = ""

# Markup related config in Hugo
[markup]
  # Syntax Highlighting
  [markup.highlight]
    codeFences = true
    guessSyntax = true
    lineNos = true
    lineNumbersInTable = true
    # false is a necessary configuration
    # (https://github.com/dillonzq/LoveIt/issues/158)
    noClasses = false
  # Goldmark is from Hugo 0.60 the default library used for Markdown
  [markup.goldmark]
    [markup.goldmark.extensions]
      definitionList = true
      footnote = true
      linkify = true
      strikethrough = true
      table = true
      taskList = true
      typographer = true
    [markup.goldmark.renderer]
      # whether to use HTML tags directly in the document
      unsafe = true
  # Table Of Contents settings
  [markup.tableOfContents]
    startLevel = 2
    endLevel = 6

# Sitemap config
[sitemap]
  changefreq = "weekly"
  filename = "sitemap.xml"
  priority = 0.5

# Permalinks config
[Permalinks]
  # posts = ":year/:month/:contentbasename"
  posts = ":contentbasename"

# Privacy config
[privacy]
  # LoveIt CHANGED | 0.3.1 privacy of the Google Analytics (can also be configured in params.analytics.google)
  [privacy.googleAnalytics]
    # ...
  [privacy.twitter]
    # ...
  [privacy.youtube]
    # ...

# LoveIt NEW | 0.4.2 Output format of llms.txt, see [Markdown Output and llms.txt](#llms-txt)
[outputFormats.llms]
  baseName = "llms"
  mediaType = "text/plain"
  isPlainText = true
  notAlternative = true

# Options to make hugo output files
[outputs]
  # LoveIt CHANGED | 0.4.2
  home = ["HTML", "RSS", "JSON", "llms"]
  # "markdown" is the output format built into Hugo for the .md version of a page
  page = ["HTML", "markdown"]
  section = ["HTML", "RSS"]
  taxonomy = ["HTML", "RSS"]
Note
Note that some of these parameters are explained in details in other sections of this documentation.
Hugo environments

Default environments are development with hugo serve and production with hugo.

Due to limitations in the local development environment, the comment system, CDN and fingerprint will not be enabled in the development environment. LoveIt NEW | 0.4.3 Outside the production environment, every page also asks search engines not to index it (see Search Engines and robots.txt).

You could enable these features with hugo serve -e production.

One comment system per page

LoveIt CHANGED | 0.4.3

A page shows one comment system: the one that type names, with the options in its own section. The other sections can stay in the configuration; they are not used. A page can choose another comment system with comment.type in its front matter, and comment: false (or enable: false under comment) hides the comments of a page. comment: true shows them on a page even where enable = false in the site configuration.

[params.page.comment]
  enable = true
  type = "giscus"
  [params.page.comment.giscus]
    repo = "owner/repo"
    # ...

Each comment system used to have an enable of its own, and several could be shown on a page. That enable is deprecated: until 0.5.0, a page without a type shows the first comment system with enable = true, those in its front matter first, in the order of the configuration above, and the build warns when more than one is on. enable: false under a comment system in the front matter still hides that comment system on the page. Remove it, and set comment: false if the page should have no comments, or comment.type to show another comment system.

Notes about comment systems

For a new site, giscus is recommended. It stores comments in GitHub Discussions and does not need any secret in your site. The notes below were checked on November 26, 2026.

Gitalk: the theme bundles Gitalk 1.8.0, which logs visitors in with a GitHub OAuth App. The clientSecret you configure is written into each page that renders Gitalk, so anyone can read it in the page source. When a visitor logs in, Gitalk 1.x also sends the login code and this secret to GitHub through a CORS proxy run by a third party (cors-anywhere.azm.workers.dev), and the theme has no option to change this proxy. The Gitalk repository now marks the 1.x line as end-of-life. If you keep Gitalk, use an OAuth App that is only used for these comments.

Commento: the theme loads the hosted Commento script from https://cdn.commento.io/js/commento.js and has no option for a self-hosted Commento server. Users reported commento.io down in December 2025, and on November 26, 2026 a request for https://commento.io/ or for the script URL above was redirected to an unrelated third-party page (or answered with HTTP 404) instead of serving Commento. Do not enable this option, because the browser would load a script from a domain that no longer serves Commento. The open source code has had no commits since February 2021. If you run your own Commento server, this option cannot be pointed at it. Comentario, a maintained fork of Commento that can import Commento’s comments, is supported with params.page.comment.comentario (see “Comentario comments” below).

Valine: Valine is licensed under GPL-2.0-only (its package declares the SPDX identifier GPL-2.0), and when it is enabled the theme serves the bundled copy (assets/lib/valine/Valine.min.js), or loads it from the CDN that params.cdn.data configures. Valine has no server of its own: it stores comments in a LeanCloud app, which is what appId, appKey and serverURLs refer to. LeanCloud stopped new sign-ups and new apps on January 12, 2026, and will shut down all public services on January 12, 2027. After that, Valine cannot load or save comments, and LeanCloud says it will permanently destroy or anonymize the user data it retains. Export your comments before that date and move to another comment system.

Twikoo comments

LoveIt NEW | 0.4.3

Twikoo needs a Twikoo server, which you deploy yourself (see the Twikoo documentation). Set envId to the URL of the server, or to the ID of the environment for a server on Tencent CloudBase:

[params.page.comment]
  enable = true
  type = "twikoo"
  [params.page.comment.twikoo]
    envId = "https://twikoo.example.com"

The theme bundles the Twikoo client, which it serves from assets/lib/twikoo/, or loads from the CDN that params.cdn.data configures. For an envId that is not an http:// or https:// URL, it loads the larger build with the Tencent CloudBase SDK. The client is shown in the language of the page when Twikoo has a translation for it (English, Simplified and Traditional Chinese, Japanese, Korean, Vietnamese or Indonesian), and in English otherwise. Set lang to choose another translation, such as zh-HK or uz-UZ. A client served from the site imports the translations other than English and Simplified Chinese from lib/twikoo/locales/, which the theme deploys with it.

Mastodon comments

LoveIt NEW | 0.4.2

With type = "mastodon", the comments of a page are the public replies to a post on Mastodon or another Fediverse server with the Mastodon API. Publish a post about the page, then set its URL in the front matter of the page:

comment:
  enable: true
  type: mastodon
  mastodon:
    url: https://mastodon.social/@user/113456789012345678

Visitors comment by replying to that post from their own Fediverse account; the page has no comment form. When the comments come into view, the browser of the visitor reads the post and its replies from the server in the URL (/api/v1/statuses/:id and /api/v1/statuses/:id/context), so that server sees the visitor’s IP address. Only the public and unlisted replies that this server knows of are shown, and a server that requires a login for its API cannot be used. The replies are sanitized with DOMPurify, which the theme serves from assets/lib/dompurify/, or loads from the CDN that params.cdn.data configures. With params.fingerprint set, a CDN URL of the bundled version (dompurify@<version>/dist/purify.min.js, as in the theme’s CDN data files) is checked against the bundled file with SRI.

Comentario comments

LoveIt NEW | 0.4.3

Comentario is an open source comment server that you run yourself. It can import comments from Commento, Disqus and WordPress. Register the domain of your site in the Comentario administration UI, then set the URL of your server:

[params.page.comment]
  enable = true
  type = "comentario"
  [params.page.comment.comentario]
    url = "https://comments.example.com"

The theme loads comentario.js from that URL and shows the comments in a <comentario-comments> element, so the browser of each visitor connects to your Comentario server. Comentario keeps the comments of a page by the path of its URL, so each translation of a page has its own comments. The theme attribute of the element follows the theme of the site. Comentario 3.18.0 or later repaints the comments when the theme switches; an older server shows the new theme after a reload. With lang empty, Comentario uses the language of the page and falls back to English if it does not support that language. A URL that is not the http(s) URL of a server (with no user, query or fragment) prints a build warning and no comments are shown.

Remark42 comments

LoveIt NEW | 0.4.3

Remark42 is an open source comment server that you run yourself (version 1.17.0 or later). It can import comments from Disqus, WordPress and Commento. Set the URL of your server (its REMARK_URL), and its SITE if that is not the default remark. If the server sets ALLOWED_HOSTS, it must include the domain of your site.

[params.page.comment]
  enable = true
  type = "remark42"
  [params.page.comment.remark42]
    host = "https://remark42.example.com"
    siteId = "remark"

The theme loads web/embed.mjs from that URL, which shows the comments in an iframe, so the browser of each visitor connects to your Remark42 server. Remark42 serves web/embed.mjs since 1.17.0; an older server, or a proxy or CDN that only serves web/embed.js, shows no comments. Remark42 keeps the comments of a page by its permalink, so each translation of a page has its own comments. The comments follow the theme of the site, also when it switches. With locale empty, Remark42 uses the language of the page, and English if it does not support that language. A URL that is not the http(s) URL of a server (with no user, query or fragment) prints a build warning and no comments are shown.

Tips about CDN Configuration

LoveIt CHANGED | 0.4.3

[params.cdn]
  # CDN data file name, default is "" (serve the library files bundled with the theme)
  # ["jsdelivr.yml", "jsdelivr.fastly.yml", "jsdelivr.cloudflare.yml", "unpkg.yml"]
  data = ""

By default, the theme serves the third-party library files bundled with it from your site, so pages load no library from a CDN. Set data = "jsdelivr.yml" (or another CDN data file) to load them from a CDN instead. The CDN is used only in the production environment; other environments always serve the bundled files. The default CDN data files are located in the assets/data/cdn/ directory of the theme. You can store your own data file in the same path under your project: assets/data/cdn/. If data names a file that does not exist, the build prints a warning and the bundled local files are used.

Tips about social Configuration

LoveIt NEW | 0.2.0

You can directly set your ID to get a default social link and its icon:

[params.social]
  Mastodon = "@xxxx"

The social link generated is https://mastodon.technology/@xxxx.

Or You can set more options through a dict:

[params.social]
  [params.social.Mastodon]
    # weight when arranging icons (the greater the weight, the later the icon is positioned)
    weight = 0
    # your social ID
    id = "@xxxx"
    # prefix of your social link
    prefix = "https://mastodon.social/"
    # content hovering on the icon
    title = "Mastodon"

The default data of all supported social links is located in assets/data/social.yml of the theme, which is you can refer to.

Complete configuration preview
Complete configuration preview

3.2 Favicons, Browserconfig, Manifest

It is recommended to put your own favicons:

  • apple-touch-icon.png (180x180)
  • favicon-32x32.png (32x32)
  • favicon-16x16.png (16x16)
  • mstile-150x150.png (150x150)
  • android-chrome-192x192.png (192x192)
  • android-chrome-512x512.png (512x512)

into /static. They’re easily created via https://realfavicongenerator.net/.

The theme links site.webmanifest and safari-pinned-tab.svg from the site root, so customize site.webmanifest to set the theme color and background color of the installed web app. The theme-color and msapplication-TileColor meta tags and the Safari mask icon color come from themeColor, tileColor and iconColor in [params.app]. The theme does not reference browserconfig.xml, so it is not needed.

3.3 Style Customization

LoveIt CHANGED | 0.2.8
Customized styles need Dart Sass

LoveIt CHANGED | 0.4.3 The theme ships its  SCSS compiled to  CSS. When your site changes the theme styles, Hugo compiles them again with Dart Sass, which you then need to install.

Your site changes the theme styles when assets/css/_override.scss or assets/css/_custom.scss has more than comments (a /*! ... */ comment counts, as Sass keeps it in the CSS), or when it has other .scss or .sass files under assets/css, or files under assets/lib/modern-normalize, even ones that the styles do not import. If Dart Sass is missing, the build fails with an error that lists these files.

LoveIt theme has been built to be as configurable as possible by defining custom .scss style files.

The directory including the custom .scss style files is assets/css relative to your project root directory.

In assets/css/_override.scss, you can override the variables in assets/css/_variables.scss of the theme to customize the style.

Here is a example:

@import url('https://fonts.googleapis.com/css?family=Fira+Mono:400,700&display=swap&subset=latin-ext');
$code-font-family: Fira Mono, Source Code Pro, Menlo, Consolas, Monaco, monospace;

In assets/css/_custom.scss, you can add some css style code to customize the style.

3.4 Markdown Output and llms.txt

LoveIt NEW | 0.4.2

With the markdown output format, which is built into Hugo, each page is also published as index.md next to its index.html:

[outputs]
  page = ["HTML", "markdown"]

Every page that has this output links its Markdown version in the <head> with <link rel="alternate" type="text/markdown">, so tools and LLM crawlers find it without parsing the page. linkToMarkdown in [params.page] also shows a link to it in the post footer.

The theme also has a default llms.txt template, layouts/home.llms.txt. To publish /llms.txt, define the llms output format and add it to the outputs of home in your site configuration:

[outputFormats.llms]
  baseName = "llms"
  mediaType = "text/plain"
  isPlainText = true
  notAlternative = true

[outputs]
  home = ["HTML", "RSS", "JSON", "llms"]
  page = ["HTML", "markdown"]

llms.txt starts with the site title and description in [params]. It lists the pages outside any section under a “Pages” heading in the language of the site, then the pages of each top-level section under a heading with the section title, nested sections included. Each page links to its Markdown version when it has one, otherwise to its HTML page, with the description from its front matter. Pages hidden from search (hiddenFromSearch) and pages that publish neither are left out. A multilingual site has one llms.txt per language, in the root of each language, such as /zh-cn/llms.txt. Each page links the llms.txt of its language with <link rel="describedby">.

To change the content, copy layouts/home.llms.txt of the theme to layouts/home.llms.txt in your project and edit it.

Remove the old Markdown output settings

Site configurations based on the example of earlier versions make the .md files with these settings:

[mediaTypes]
  [mediaTypes."text/plain"]
    suffixes = ["md"]

[outputFormats.MarkDown]
  mediaType = "text/plain"
  isPlainText = true
  isHTML = false

Remove both before you add the llms output format, and use markdown in the outputs of page. Otherwise text/plain files end in .md: Hugo looks for home.llms.md and publishes no llms.txt, and it no longer finds the Markdown template of the pages.

3.5 Search Engines and robots.txt

LoveIt NEW | 0.4.3

Outside the production environment, for example a staging site built with hugo --environment staging, every page and alias redirect has <meta name="robots" content="noindex, nofollow">, so that search engines that crawl a preview deployment keep it out of their results. Deploy only production builds as the public website. Hugo builds in the production environment by default.

Search engines must be able to crawl the pages
A search engine only sees the noindex meta tag of a page it may crawl. The robots.txt of the theme lets crawlers crawl every page, also outside the production environment; a Disallow rule for a page could leave its URL in search results. A preview that must stay private needs a password or another kind of authentication on the host: noindex only keeps public pages out of search results. The meta tag does not cover files such as images and PDFs either; for public files that must stay out of search results, have the host send an X-Robots-Tag: noindex header.

In the production environment, a page with hiddenFromSearchEngines: true in its front matter has <meta name="robots" content="noindex"> and is left out of sitemap.xml, including the hreflang alternates of its translations. Set hiddenFromSearchEngines = true in [params.page] to hide every page by default, then hiddenFromSearchEngines: false in the front matter of a page to show it again. A page with sitemap.disable: true in its front matter has no entry of its own in sitemap.xml, but it can still appear as an alternate of its translations, as in Hugo.

With enableRobotsTXT = true, robots.txt allows all crawlers. In the production environment it also links the sitemap at the baseURL, named after the filename of the sitemap configuration (sitemap.xml by default). Crawlers only read robots.txt at the root of a host: when the baseURL has a path, such as https://example.org/project/, put the rules and the Sitemap line in the robots.txt at the root of the host instead. To add your own rules, or to drop the Sitemap line when you turn off the sitemap, copy layouts/robots.txt of the theme to layouts/robots.txt in your project and edit it.

4 Multilingual and i18n

LoveIt theme is fully compatible with Hugo multilingual mode, which provides in-browser language switching.

Language Switch
Language Switch

4.1 Compatibility

LanguageHugo CodeHTML lang AttributeTheme Docs
Englishenen
Simplified Chinesezh-cnzh-CN
Traditional Chinesezh-twzh-TW
Frenchfrfr
Polishplpl
Portuguese (Brazil)pt-brpt-BR
Italianitit
Spanisheses
Germandede
Serbiansrsr
Russianruru
Romanianroro
Vietnamesevivi
Arabicarar
Catalancaca
Thaithth
Telugutete
Indonesianidid
Turkishtrtr
Koreankoko
Hindihihi
Dutchnlnl
Bengalibnbn
Japanese LoveIt NEW | 0.3.1jaja
Swedish LoveIt NEW | 0.3.1svsv
Ukrainian LoveIt NEW | 0.3.0ukuk

4.2 Basic Configuration

After learning how Hugo handle multilingual websites, define your languages in your site configuration.

For example with English, Chinese and French website:

# determines default content language ["en", "zh-cn", "fr", "pl", ...]
defaultContentLanguage = "en"

[languages]
  [languages.en]
    weight = 1
    title = "My New Hugo Site"
    locale = "en"
    label = "English"
    [[languages.en.menu.main]]
      weight = 1
      identifier = "posts"
      pre = ""
      post = ""
      name = "Posts"
      url = "/posts/"
      title = ""
    [[languages.en.menu.main]]
      weight = 2
      identifier = "tags"
      pre = ""
      post = ""
      name = "Tags"
      url = "/tags/"
      title = ""
    [[languages.en.menu.main]]
      weight = 3
      identifier = "categories"
      pre = ""
      post = ""
      name = "Categories"
      url = "/categories/"
      title = ""

  [languages.zh-cn]
    weight = 2
    title = "我的全新 Hugo 网站"
    locale = "zh-CN"
    label = "简体中文"
    hasCJKLanguage = true
    [[languages.zh-cn.menu.main]]
      weight = 1
      identifier = "posts"
      pre = ""
      post = ""
      name = "文章"
      url = "/posts/"
      title = ""
    [[languages.zh-cn.menu.main]]
      weight = 2
      identifier = "tags"
      pre = ""
      post = ""
      name = "标签"
      url = "/tags/"
      title = ""
    [[languages.zh-cn.menu.main]]
      weight = 3
      identifier = "categories"
      pre = ""
      post = ""
      name = "分类"
      url = "/categories/"
      title = ""

  [languages.fr]
    weight = 3
    title = "Mon nouveau site Hugo"
    locale = "fr"
    label = "Français"
    [[languages.fr.menu.main]]
      weight = 1
      identifier = "posts"
      pre = ""
      post = ""
      name = "Postes"
      url = "/posts/"
      title = ""
    [[languages.fr.menu.main]]
      weight = 2
      identifier = "tags"
      pre = ""
      post = ""
      name = "Balises"
      url = "/tags/"
      title = ""
    [[languages.fr.menu.main]]
      weight = 3
      identifier = "categories"
      name = "Catégories"
      pre = ""
      post = ""
      url = "/categories/"
      title = ""

Then, for each new page, append the language code to the file name.

Single file my-page.md is split in three files:

  • in English: my-page.en.md
  • in Chinese: my-page.zh-cn.md
  • in French: my-page.fr.md
Note
Be aware that only translated pages are displayed in menu. It’s not replaced with default language content.
Tip
Use Front Matter parameter to translate urls too.

4.3 Overwrite Translation Strings

Translations strings are used for common default values used in the theme. Translations are available in some languages, but you may use another language or want to override default values.

To override these values, create a new file in your local i18n folder i18n/<languageCode>.toml and inspire yourself from i18n/en.toml of the theme.

By the way, as these translations could be used by other people, please take the time to propose a translation by  making a PR to the theme!

LoveIt NEW | 0.2.0

Based on Fuse.js, algolia or Pagefind, searching is supported in LoveIt theme. LoveIt CHANGED | 0.4.3 Lunr.js was removed; the deprecated type = "lunr" searches with Fuse.js until 0.5.0.

5.1 Output Configuration

In order to generate index.json for searching, add JSON output file type to the home of the outputs part in your site configuration. fuse and algolia need this file; pagefind builds its own index and does not. LoveIt CHANGED | 0.4.3 The file lists the pages only while params.search.enable is true and type is not "pagefind"; otherwise it is an empty array [].

[outputs]
  home = ["HTML", "RSS", "JSON"]

5.2 Search Configuration

Based on index.json generated by Hugo, you could activate searching.

Here is the search configuration in your site configuration:

[params.search]
  enable = true
  # LoveIt CHANGED | 0.4.3 type of search engine ["fuse", "algolia", "pagefind"] ("lunr" is deprecated)
  type = "fuse"
  # max index length of the chunked content
  contentLength = 4000
  # placeholder of the search bar
  placeholder = ""
  # LoveIt NEW | 0.2.1 max number of results length
  maxResultLength = 10
  # LoveIt NEW | 0.2.3 snippet length of the result
  snippetLength = 30
  # LoveIt NEW | 0.2.1 HTML tag name of the highlight part in results
  highlightTag = "em"
  # LoveIt NEW | 0.2.4 whether to use the absolute URL based on the baseURL in search index
  absoluteURL = false
  [params.search.algolia]
    index = ""
    appID = ""
    searchKey = ""
  # LoveIt NEW | 0.4.0 Fuse.js options
  [params.search.fuse]
    isCaseSensitive = false
    minMatchCharLength = 2
    findAllMatches = false
    location = 0
    threshold = 0.3
    distance = 100
    ignoreLocation = true # LoveIt CHANGED | 0.4.3 match anywhere in the content
  # LoveIt NEW | 0.4.0 Pagefind config
  [params.search.pagefind]
    # directory of the Pagefind index, relative to the baseURL
    basePath = "/_pagefind/"
How to choose search engine?

The following is a comparison of the search engines:

  • fuse LoveIt NEW | 0.4.0 (default LoveIt NEW | 0.4.3): fuzzy search in the browser from index.json, no service to synchronize and no language library, but the whole index.json is downloaded on the first query
  • algolia: high performance and low bandwidth, but need to synchronize index.json and limit for contentLength
  • pagefind LoveIt NEW | 0.4.0: a static index split into small chunks, so low bandwidth even on large sites and no service to synchronize, but the index must be generated after every build

LoveIt NEW | 0.2.3 The content of the post is separated by h2 and h3 HTML tag to improve query performance and basically implement full-text search. contentLength is used to limit the max index length of the part starting with h2 and h3 HTML tag.

Tips about algolia
You need to upload index.json files to algolia to activate searching. You could upload the index.json files by browsers but a CLI tool may be better. The official Algolia CLI is a good choice. To be compatible with Hugo multilingual mode, you need to upload different index.json for each language to the different index of algolia, such as zh-cn/index.json or fr/index.json…
Tips about Pagefind

LoveIt NEW | 0.4.0

Pagefind indexes the HTML files that Hugo has published, so generate the index after every build:

hugo
npx pagefind --site public --output-subdir _pagefind

Hugo does not remove the output of deleted or renamed pages from public, and Pagefind would index them again. After deleting or renaming pages, delete public before you run hugo. Also delete it after turning search off or switching to another engine: the old index stays in public and would be published. Keep files that are not generated by Hugo in static. npx comes with Node.js; without Node.js, use the standalone Pagefind binary with the same arguments.

--output-subdir must be the same directory as basePath in [params.search.pagefind]. Pages with hiddenFromSearch and the pages of a language whose search is off or uses another engine are not indexed. On a single-host site, one run indexes all languages. On a multihost site, each language is built into its own directory, such as public/en. Run the command once for the directory of each language that searches with Pagefind, for example npx pagefind --site public/en --output-subdir _pagefind, so that each host serves its own index. Skip the directories of the other languages, and skip the command when no language searches with Pagefind: Pagefind fails when it finds no page to index.

hugo server does not generate the index. To preview the search, build the site and serve the output:

npx pagefind --site public --output-subdir _pagefind --serve

The preview serves public at the root. If your baseURL contains a subpath, build the preview with hugo --baseURL /. On a multihost site, preview one language at a time, for example with npx pagefind --site public/en --output-subdir _pagefind --serve.

6 Version Migration

This section explains how to upgrade the theme and what to check when you upgrade to a new version. If you skip versions, follow the guide of every version between yours and the new one.

6.1 Upgrade the Theme

Before you upgrade, read the guides below and the changelog. Then switch the theme to the latest release, with the method you installed it with:

  • Hugo Module. Get the latest release, then commit go.mod and go.sum:

    hugo mod get github.com/dillonzq/LoveIt@latest
  • Git submodule. Make the submodule follow the release branch (a submodule added without -b release follows master), update it to the latest commit of that branch, then commit the new version in your site repository, so that your build service builds it:

    git submodule set-branch --branch release themes/LoveIt
    git submodule update --remote themes/LoveIt
    git add .gitmodules themes/LoveIt
    git commit -m "Upgrade LoveIt"
  • Git clone. Fetch the release branch and switch to its latest commit (a clone made without -b release is on master):

    git -C themes/LoveIt fetch origin
    git -C themes/LoveIt checkout -B release origin/release
  • Release .zip file. Download the Source code (zip) of the latest release and replace the themes/LoveIt directory with its extracted LoveIt-x.y.z directory, renamed to LoveIt.

To use a specific version, use its tag instead, such as hugo mod get github.com/dillonzq/LoveIt@v0.4.2 or git -C themes/LoveIt checkout v0.4.2. For a submodule, then commit themes/LoveIt, so that your build service builds that version. To return to the latest release, follow the steps above again.

6.2 Upgrade from 0.3.X to 0.4.X

LoveIt NEW | 0.4.0

Check the following when you upgrade from LoveIt 0.3.X to 0.4.X.

6.2.1 What You Must Do

  • Upgrade Hugo to 0.146.0 or later. LoveIt 0.3.X supported Hugo 0.128.0 - 0.145.0.
  • Install Dart Sass if your site needs it. The theme no longer compiles with LibSass, so the extended edition of Hugo alone is not enough to compile its styles. Since 0.4.3, Dart Sass is needed only for customized styles and the style shortcode; install it on your build service (Netlify, Vercel, GitHub Actions…) as well.
  • Check your custom styles. assets/css/_override.scss and assets/css/_custom.scss work as before, but they are now compiled by Dart Sass, which may warn about or reject syntax that LibSass accepted.
  • Check your template overrides. The theme templates now follow the new template system of Hugo and live in layouts/_partials, layouts/_shortcodes and layouts/_markup. If your site overrides theme templates, compare them with the new ones.

6.2.2 What Has Changed

  • Language configuration. On Hugo 0.158.0 or later, use locale and label instead of the deprecated languageCode and languageName.
  • Polyfill. params.compatibility.polyfill loads from cdnjs.cloudflare.com instead of polyfill.io in 0.4.X. LoveIt 0.4.2 removes the Polyfill service, see Deprecated Options.
  • Music. The default Meting API has been replaced. Set api in [params.page.music] to use your own.
  • Waline. The bundled client is Waline v3, which requires a Waline server v1.27.1 or later.

6.2.3 What Is New

  • Fuse.js and Pagefind search engines
  • Content-Security-Policy meta tag ([params.security])
  • Server-side rendering of mathematical formulas, Markdown table and blockquote alert render hooks
  • Extra text below the subtitle of the home page profile (extra in [params.home.profile])

6.3 Deprecated Options

LoveIt NEW | 0.4.2

When your site configuration uses a deprecated option, hugo prints a warning once per build like the one below. The warning is printed until the version in the “Removed in” column. Deprecated options are removed in the next minor version (0.x.0), which LoveIt releases only when it raises the minimum supported Hugo version. Some options no longer have any effect; the table says what to do with each one. The build does not fail unless you build with --panicOnWarning. To keep such a build passing while you migrate, add the ID from the warning to ignoreLogs.

WARN  LoveIt: "params.compatibility.polyfill" is deprecated since v0.4.2 and will be removed in v0.5.0. ...
You can suppress this warning by adding the following to your site configuration:
ignoreLogs = ['loveit-deprecated-params-compatibility-polyfill']

An option counts as used when it is set to a value other than false or an empty string, so the false defaults copied from the theme configuration do not warn. A deprecated value, such as params.search.type = "lunr", warns only when the option is set to that value.

OptionDeprecated inRemoved inWhat to do
params.compatibility.polyfill0.4.20.5.0Remove it. It has no effect: the theme no longer loads the Polyfill service, which the browsers it supports do not need.
params.compatibility.objectFit0.4.20.5.0Remove it. It has no effect: the theme no longer loads object-fit-images, because the browsers it supports handle object-fit natively.
params.cdn.autocompleteJS0.4.20.5.0Remove it. Search no longer uses autocomplete.js.
params.page.comment.<name>.enable (any comment system)0.4.30.5.0Set params.page.comment.type = "<name>" and remove it; in front matter, comment.<name>.enable: true becomes comment.type: <name>, and comment.<name>.enable: false is removed (with comment: false if the page should have no comments, or comment.type set to another comment system). A page shows one comment system. Until then, a page without a type shows the first comment system with enable on (see “One comment system per page”). The front matter key warns with the ID loveit-deprecated-front-matter-comment-<name>-enable.
params.search.type = "lunr"0.4.30.5.0Set it to "fuse": Lunr.js was removed, so the option already searches with Fuse.js from the same index.json. Removing it also works where the inherited type is Fuse.js, the default; a language-level setting would otherwise fall back to the site-level type. Or choose "algolia" or "pagefind".