fix: translation for navbar menu

docs: update docs for multi-language
chore: add custom css support
chore: add social icons
This commit is contained in:
Xin
2023-08-21 01:00:52 +01:00
parent aa1305099d
commit 8073722a0e
12 changed files with 110 additions and 20 deletions

View File

@ -9,8 +9,8 @@ Welcome to the Hextra documentation!
**Hextra** is a modern, responsive and powerful [Hugo](https://gohugo.io/) theme built with [Tailwind CSS](https://tailwindcss.com/). It is inspired by Next.js theme [Nextra](https://github.com/shuding/nextra).
It is designed for building websites for documentation, blogs, books and landing pages.
It is easy to use out of the box, and batteries are included to make your site fast and beautiful.
It is designed for building beautiful websites for documentation, blogs, books and landing pages.
It is easy to use out of the box, and batteries are included to make your site versatile and powerful.
## Features
@ -19,14 +19,14 @@ It is easy to use out of the box, and batteries are included to make your site f
- **Lightweight and Fast** - Hextra is solely dependent on Hugo, one of the world's fastest static site generator that comes with just a single binary file.
- **Full-text Search** - Hextra offers built-in offline full-text search powered by [FlexSearch](https://github.com/nextapps-de/flexsearch).
- **Battery included** - Hextra supports Markdown, syntax highlighting, LaTeX, diagrams, and comes with Shortcodes components as building blocks for your Markdown content.
- **Muliti-language** - Hextra supports multi-language sites out of the box.
- **Multi-language Support** - Multi-language sites made easy with Hugo's multilingual mode.
- **SEO Friendly** - Out of the box support for SEO tags, Open Graph, and Twitter Cards.
- **Customizable** - You can easily customize the theme to make the site look the way you want.
## Next
Explore the following sections to get started:
Explore the following section to get started:
{{< cards >}}
{{< card link="/" title="Getting Started" icon="play" >}}
{{< card link="getting-started" title="Getting Started" icon="play" >}}
{{< /cards >}}

View File

@ -2,3 +2,7 @@
title: Customizing Hextra
linkTitle: Customization
---
## Custom CSS
To add custom CSS, we need to create a file `assets/css/custom.css` in our site. Hextra will automatically load this file.

View File

@ -0,0 +1,70 @@
---
title: "Multi-language"
weight: 1
---
Hextra supports creating site with multiple languages using Hugo's [multilingual mode](https://gohugo.io/content-management/multilingual/).
## Enable Multi-language
To make our site multi-language, we need to tell Hugo the supported languages. We need to add to the site configuration file:
```yaml {filename="hugo.yaml"}
defaultContentLanguage: en
languages:
en:
languageName: English
weight: 1
fr:
languageName: Français
weight: 2
ja:
languageName: 日本語
weight: 3
```
## Manage Translations by Filename
Hugo supports managing translations by filename. For example, if we have a file `content/docs/_index.md` in English, we can create a file `content/docs/_index.fr.md` for French translation.
{{< filetree/container >}}
{{< filetree/folder name="content" >}}
{{< filetree/folder name="docs" state="open" >}}
{{< filetree/file name="_index.md" >}}
{{< filetree/file name="_index.fr.md" >}}
{{< filetree/file name="_index.ja.md" >}}
{{< /filetree/folder >}}
{{< /filetree/folder >}}
{{< /filetree/container >}}
Note: Hugo also supports [Translation by content directory](https://gohugo.io/content-management/multilingual/#translation-by-content-directory).
## Translate Menu Items
To translate menu items in the navigation bar, we need to set the `identifier` field:
```yaml {filename="hugo.yaml"}
menu:
main:
- identifier: documentation
name: Documentation
pageRef: /docs
weight: 1
- identifier: blog
name: Blog
pageRef: /blog
weight: 2
```
and translate them in the corresponding i18n file:
```yaml {filename="i18n/fr.yaml"}
documentation: Documentation
blog: Blog
```
## Read More
- [Hugo Multilingual Mode](https://gohugo.io/content-management/multilingual/)
- [Hugo Multilingual Part 1: Content translation](https://www.regisphilibert.com/blog/2018/08/hugo-multilingual-part-1-managing-content-translation/)
- [Hugo Multilingual Part 2: Strings localization](https://www.regisphilibert.com/blog/2018/08/hugo-multilingual-part-2-i18n-string-localization/)

View File

@ -29,7 +29,6 @@ menu:
weight: 4
params:
type: search
placeholder: Search Hextra docs...
- name: GitHub
weight: 5
url: "https://github.com/imfing/hextra"
@ -54,7 +53,6 @@ There are different types of menu items:
- name: Search
params:
type: search
placeholder: Search Hextra docs...
```
4. Icon
```yaml