hextra/exampleSite/content/docs/guide/configuration.md
Xin 8073722a0e fix: translation for navbar menu
docs: update docs for multi-language
chore: add custom css support
chore: add social icons
2023-08-21 01:00:52 +01:00

2.7 KiB

title weight
Configuration 2

Hugo reads its configuration from hugo.yaml in the root of your Hugo site. The config file is where you can configure all aspects of your site. You can find the config file for this site in exampleSite/hugo.yaml as a good starting point.

Navigation

Menu

Top right menu is defined under the menu.main section in the config file:

menu:
  main:
    - name: Documentation
      pageRef: /docs
      weight: 1
    - name: Blog
      pageRef: /blog
      weight: 2
    - name: About
      pageRef: /about
      weight: 3
    - name: Search
      weight: 4
      params:
        type: search
    - name: GitHub
      weight: 5
      url: "https://github.com/imfing/hextra"
      params:
        icon: github

There are different types of menu items:

  1. Link to a page in the site with pageRef
    - name: Documentation
      pageRef: /docs
    
  2. Link to an external URL with url
    - name: GitHub
      url: "https://github.com"
    
  3. Search bar with type: search
    - name: Search
      params:
        type: search
    
  4. Icon
    - name: GitHub
      params:
        icon: github
    

These menu items can be sorted by setting the weight parameter.

Sidebar

Main Sidebar

For the main sidebar, it is automatically generated from the structure of the content directory. See the Organize Files page for more details.

Sidebar extra links are defined under the menu.sidebar section in the config file:

menu:
  sidebar:
    - name: More
      params:
        type: separator
      weight: 1
    - name: "About"
      pageRef: "/about"
      weight: 2
    - name: "Hugo Docs ↗"
      url: "https://gohugo.io/documentation/"
      weight: 3

Right Sidebar

Table of Contents

Table of contents is automatically generated from the headings in the content file. It can be disabled by setting toc: false in the front matter of the page.

---
title: Configuration
toc: false
---

To configure the page edit link, we can set the params.editURL.base parameter in the config file:

params:
  editURL:
    base: "https://github.com/your-username/your-repo/edit/main"

The edit links will be automatically generated for each page. If you want to set edit link for a specific page, you can set the params.editURL parameter in the front matter of the page:

---
title: Configuration
params:
  editURL: "https://example.com/edit/this/page"
---