docs: add customization and update other pages

chore: re-compile css and add icons
chore: update blog list layout
This commit is contained in:
Xin 2023-08-21 23:41:37 +01:00
parent ce78845226
commit 5821b02db2
12 changed files with 189 additions and 156 deletions

View File

@ -2126,10 +2126,6 @@ video {
margin-left: 1rem;
}
.ml-auto {
margin-left: auto;
}
.mr-1 {
margin-right: 0.25rem;
}
@ -3811,9 +3807,6 @@ body {
.md\:inline-block {
display: inline-block;
}
.md\:inline {
display: inline;
}
.md\:hidden {
display: none;
}

View File

@ -27,6 +27,8 @@ cards: <svg xmlns="http://www.w3.org/2000/svg" fill="none" stroke="currentColor"
copy: <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z" /></svg>
hamburger-menu: <svg fill="none" viewBox="0 0 24 24" stroke="currentColor"><g><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 8H20"></path></g><g><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16H20"></path></g></svg>
markdown: <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="currentColor" d="M20.56 18H3.44C2.65 18 2 17.37 2 16.59V7.41C2 6.63 2.65 6 3.44 6h17.12c.79 0 1.44.63 1.44 1.41v9.18c0 .78-.65 1.41-1.44 1.41M6.81 15.19v-3.66l1.92 2.35l1.92-2.35v3.66h1.93V8.81h-1.93l-1.92 2.35l-1.92-2.35H4.89v6.38h1.92M19.69 12h-1.92V8.81h-1.92V12h-1.93l2.89 3.28L19.69 12Z"/></svg>
folder-tree: <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><path fill="currentColor" d="m 114.47781,81.538059 c 0,-13.785609 -11.07754,-24.923135 -24.78889,-24.923135 -13.711352,0 -24.788885,11.137526 -24.788885,24.923135 V 355.69254 c 0,27.49333 22.232532,49.84627 49.577775,49.84627 H 263.21112 V 355.69254 H 114.47781 V 181.2306 H 263.21112 V 131.38433 H 114.47781 Z M 288,206.15373 c 0,13.78561 11.07753,24.92314 24.78888,24.92314 h 173.5222 c 13.71135,0 24.78888,-11.13753 24.78888,-24.92314 v -99.69254 c 0,-13.785605 -11.07753,-24.923131 -24.78888,-24.923131 h -76.45822 c -6.58454,0 -12.85923,-2.648083 -17.50715,-7.321171 L 382.04283,63.936095 c -4.64791,-4.673088 -10.9226,-7.321171 -17.50715,-7.321171 h -51.7468 C 299.07753,56.614924 288,67.75245 288,81.538059 Z m 0,224.30821 c 0,13.78561 11.07753,24.92314 24.78888,24.92314 h 173.5222 c 13.71135,0 24.78888,-11.13753 24.78888,-24.92314 V 330.7694 c 0,-13.78561 -11.07753,-24.92313 -24.78888,-24.92313 h -76.45822 c -6.58454,0 -12.85923,-2.64808 -17.50715,-7.32117 l -10.30288,-10.35868 c -4.64791,-4.67309 -10.9226,-7.32117 -17.50715,-7.32117 h -51.7468 C 299.07753,280.84525 288,291.98278 288,305.76838 Z" style="stroke-width:0.776747" /></svg>
card: <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15"><path fill="currentColor" fill-rule="evenodd" d="M14 11V4H1v7h13Zm1-7v7a1 1 0 0 1-1 1H1a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h13a1 1 0 0 1 1 1ZM2 5.25A.25.25 0 0 1 2.25 5h3.5a.25.25 0 0 1 .25.25v4.5a.25.25 0 0 1-.25.25h-3.5A.25.25 0 0 1 2 9.75v-4.5ZM7.5 7a.5.5 0 0 0 0 1h3a.5.5 0 0 0 0-1h-3ZM7 9.5a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 0 1h-5a.5.5 0 0 1-.5-.5ZM7.5 5a.5.5 0 0 0 0 1h4a.5.5 0 0 0 0-1h-4Z" clip-rule="evenodd"/></svg>
# Icons from heroicons v1 outlined https://github.com/tailwindlabs/heroicons/tree/v1
academic-cap: <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path d="M12 14l9-5-9-5-9 5 9 5z"/><path d="M12 14l6.16-3.422a12.083 12.083 0 01.665 6.479A11.952 11.952 0 0012 20.055a11.952 11.952 0 00-6.824-2.998 12.078 12.078 0 01.665-6.479L12 14z"/><path stroke-linecap="round" stroke-linejoin="round" d="M12 14l9-5-9-5-9 5 9 5zm0 0l6.16-3.422a12.083 12.083 0 01.665 6.479A11.952 11.952 0 0012 20.055a11.952 11.952 0 00-6.824-2.998 12.078 12.078 0 01.665-6.479L12 14zm-4 6v-7.5l4-2.222"/></svg>

View File

@ -1,5 +1,6 @@
---
title: About
toc: false
---
This is the about page.

View File

@ -1,3 +1,3 @@
---
title: "Hextra Blog"
title: "Blog"
---

View File

@ -1,176 +1,149 @@
---
title: Markdown
math: true
title: Markdown Syntax Guide
date: 2020-01-01
authors:
- name: John Doe
link: https://example.com/johndoe
image: https://example.com/johndoe.png
- name: John Doe
link: https://example.com/johndoe
excludeSearch: true
---
This article offers a sample of basic Markdown syntax that can be used in Hugo content files, also it shows whether basic HTML elements are decorated with CSS in a Hugo theme.
This article offers a sample of basic Markdown syntax that can be used in Hugo content files.
<!--more-->
## Headings
## Basic Syntax
The following HTML `<h1>``<h6>` elements represent six levels of section headings. `<h1>` is the highest section level while `<h6>` is the lowest.
# H1
## H2
### H3
#### H4
##### H5
###### H6
## Paragraph
Xerum, quo qui aut unt expliquam qui dolut labo. Aque venitatiusda cum, voluptionse latur sitiae dolessi aut parist aut dollo enim qui voluptate ma dolestendit peritin re plis aut quas inctum laceat est volestemque commosa as cus endigna tectur, offic to cor sequas etum rerum idem sintibus eiur? Quianimin porecus evelectur, cum que nis nust voloribus ratem aut omnimi, sitatur? Quiatem. Nam, omnis sum am facea corem alique molestrunt et eos evelece arcillit ut aut eos eos nus, sin conecerem erum fuga. Ri oditatquam, ad quibus unda veliamenimin cusam et facea ipsamus es exerum sitate dolores editium rerore eost, temped molorro ratiae volorro te reribus dolorer sperchicium faceata tiustia prat.
Itatur? Quiatae cullecum rem ent aut odis in re eossequodi nonsequ idebis ne sapicia is sinveli squiatum, core et que aut hariosam ex eat.
## Blockquotes
The blockquote element represents content that is quoted from another source, optionally with a citation which must be within a `footer` or `cite` element, and optionally with in-line changes such as annotations and abbreviations.
#### Blockquote without attribution
> Tiam, ad mint andaepu dandae nostion secatur sequo quae.
> **Note** that you can use *Markdown syntax* within a blockquote.
#### Blockquote with attribution
> Don't communicate by sharing memory, share memory by communicating.<br>
> — <cite>Rob Pike[^1]</cite>
[^1]: The above quote is excerpted from Rob Pike's [talk](https://www.youtube.com/watch?v=PAAkCSZUG1c) during Gopherfest, November 18, 2015.
## Tables
Tables aren't part of the core Markdown spec, but Hugo supports them out-of-the-box.
Name | Age
--------|------
Bob | 27
Alice | 23
#### Inline Markdown within tables
| Italics | Bold | Code |
| -------- | -------- | ------ |
| *italics* | **bold** | `code` |
## Code Blocks
### Code block with triple backticks
### Headings
```
def say_hello():
print("Hello!")
# Heading 1
## Heading 2
### Heading 3
#### Heading 4
##### Heading 5
###### Heading 6
```
## Heading 2
### Heading 3
#### Heading 4
##### Heading 5
###### Heading 6
```python
def say_hello():
print("Hello!")
### Emphasis
```text
*This text will be italic*
_This will also be italic_
**This text will be bold**
__This will also be bold__
_You **can** combine them_
```
### Code block with filename
*This text will be italic*
```python {filename="hello.py"}
def say_hello():
print("Hello!")
```
_This will also be italic_
### Code block highlight with line numbers
**This text will be bold**
```python {linenos=table,hl_lines=[1, 2],linenostart=1}
def say_hello():
print("Hello!")
__This will also be bold__
def main():
say_hello()
```
_You **can** combine them_
```python {linenos=table,hl_lines=[1, 2],linenostart=1,filename="hello.py"}
def say_hello():
print("Hello!")
### Lists
def main():
say_hello()
```
## Diagrams
[Mermaid](https://github.com/mermaid-js/mermaid#readme) is a JavaScript based diagramming and charting tool that takes Markdown-inspired text definitions and creates diagrams dynamically in the browser.
```mermaid
sequenceDiagram
participant Alice
participant Bob
Alice->>John: Hello John, how are you?
loop Healthcheck
John->>John: Fight against hypochondria
end
Note right of John: Rational thoughts <br/>prevail!
John-->>Alice: Great!
John->>Bob: How about you?
Bob-->>John: Jolly good!
```
## List Types
#### Ordered List
1. First item
2. Second item
3. Third item
#### Unordered List
* List item
* Another item
* And another item
#### Nested list
* Fruit
* Apple
* Orange
* Banana
* Dairy
* Milk
* Cheese
## Math
[KaTeX](https://github.com/KaTeX/KaTeX) is a fast math typesetting library for the web. It uses javascript for client-side rendering.
### Inline
#### Unordered
```
This $\int\limits_1^\infty \frac{1}{k}\,dk$ is inline.
* Item 1
* Item 2
* Item 2a
* Item 2b
```
This $\int\limits_1^\infty \frac{1}{k}\,dk$ is inline.
* Item 1
* Item 2
* Item 2a
* Item 2b
### Separate Paragraph
#### Ordered
```
$$f(x) = \int_{-\infty}^\infty \hat f(\xi)\,e^{2 \pi i \xi x} \,d\xi$$
1. Item 1
2. Item 2
3. Item 3
1. Item 3a
2. Item 3b
```
$$f(x) = \int_{-\infty}^\infty \hat f(\xi)\,e^{2 \pi i \xi x} \,d\xi$$
### Images
```markdown
![GitHub Logo](https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png)
```
## Other Elements — abbr, sub, sup, kbd, mark
![GitHub Logo](https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png)
<abbr title="Graphics Interchange Format">GIF</abbr> is a bitmap image format.
### Links
H<sub>2</sub>O
```markdown
[Hugo](https://gohugo.io)
```
X<sup>n</sup> + Y<sup>n</sup> = Z<sup>n</sup>
[Hugo](https://gohugo.io)
Press <kbd>CTRL</kbd>+<kbd>ALT</kbd>+<kbd>Delete</kbd> to end the session.
### Blockquotes
Most <mark>salamanders</mark> are nocturnal, and hunt for insects, worms, and other small creatures.
```markdown
As Newton said:
> If I have seen further it is by standing on the shoulders of Giants.
```
> If I have seen further it is by standing on the shoulders of Giants.
### Inline Code
```markdown
Inline `code` has `back-ticks around` it.
```
Inline `code` has `back-ticks around` it.
### Code Blocks
#### Syntax Highlighting
````markdown
```go
func main() {
fmt.Println("Hello World")
}
```
````
```go
func main() {
fmt.Println("Hello World")
}
```
### Tables
```markdown
| Syntax | Description |
| --------- | ----------- |
| Header | Title |
| Paragraph | Text |
```
| Syntax | Description |
| --------- | ----------- |
| Header | Title |
| Paragraph | Text |
## References
- [Markdown Syntax](https://www.markdownguide.org/basic-syntax/)
- [Hugo Markdown](https://gohugo.io/content-management/formats/#markdown)

View File

@ -3,8 +3,11 @@ linkTitle: Advanced
title: Advanced Topics
---
This section covers some advanced topics of the theme.
<!--more-->
{{< cards >}}
{{< card link="multi-language" title="Multi-language" icon="translate" >}}
{{< card link="deployment" title="Deployment" icon="server" >}}
{{< card link="customization" title="Customization" icon="pencil" >}}
{{< /cards >}}

View File

@ -3,6 +3,56 @@ title: Customizing Hextra
linkTitle: Customization
---
Hextra offers some default customization options in the `hugo.yaml` config file to configure the theme.
This page describes the available options and how to customize the theme further.
<!--more-->
## 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.
To add custom CSS, we need to create a file `assets/css/custom.css` in our site. Hextra will automatically load this file. For example, customize the font family of the content:
```css {filename="assets/css/custom.css"}
.content {
font-family: "Times New Roman", Times, serif;
}
```
### Primary Color
The primary color of the theme can be customized by setting the `--primary-hue` variable:
```css {filename="assets/css/custom.css"}
:root {
--primary-hue: 100deg;
}
```
### Syntax Highlighting
List of available syntax highlighting themes are available at [Chroma Styles Gallery](https://xyproto.github.io/splash/docs/all.html). The stylesheet can be generated using the command:
```bash
$ hugo gen chromastyles --style=github
```
To override the default syntax highlighting theme, we can add the generated styles to the custom CSS file.
## Custom Scripts
You may add custom scripts to the end of the head for every page by adding the following file:
```
layouts/partials/custom/head-end.html
```
## Custom Layouts
The layouts of the theme can be overridden by creating a file with the same name in the `layouts` directory of your site.
For example, to override the `single.html` layout for docs, create a file `layouts/docs/single.html` in your site.
For further information, refer to the [Hugo Templates](https://gohugo.io/templates/).
## Further Customization
Didn't find what you were looking for? Feel free to [open an issue](https://github.com/imfing/hextra/issues) or make a contribution to the theme!

View File

@ -5,6 +5,8 @@ weight: 1
Hextra supports creating site with multiple languages using Hugo's [multilingual mode](https://gohugo.io/content-management/multilingual/).
<!--more-->
## 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:
@ -63,6 +65,16 @@ documentation: Documentation
blog: Blog
```
## Translate Strings
To translate strings on the other places, we need to add the translation to the corresponding i18n file:
```yaml {filename="i18n/fr.yaml"}
readMore: Lire la suite
```
A list of strings used in the theme can be found in the `i18n/en.yaml` file.
## Read More
- [Hugo Multilingual Mode](https://gohugo.io/content-management/multilingual/)

View File

@ -3,13 +3,16 @@ title: Shortcodes
weight: 9
---
Hextra provides a variety of built-in components based on [Hugo Shortcodes](https://gohugo.io/content-management/shortcodes/).
[Hugo Shortcodes](https://gohugo.io/content-management/shortcodes/) are simple snippets inside your content files calling built-in or custom templates.
Hextra provides a collection of beautiful shortcodes to enhance your content.
{{< cards >}}
{{< card link="callouts" title="Callouts" icon="warning" >}}
{{< card link="cards" title="Cards" >}}
{{< card link="filetree" title="FileTree" >}}
{{< card link="cards" title="Cards" icon="card" >}}
{{< card link="filetree" title="FileTree" icon="folder-tree" >}}
{{< card link="icon" title="Icon" icon="badge-check" >}}
{{< card link="steps" title="Steps" icon="one" >}}
{{< card link="tabs" title="Tabs" icon="collection" >}}
{{< /cards >}}

View File

@ -7,7 +7,6 @@ linkTitle: Cards
{{< cards >}}
{{< card link="/" title="Callout" icon="warning" >}}
{{< card link="/" title="GitHub" icon="github" >}}
{{< card link="/" title="No Icon" >}}
{{< /cards >}}
@ -21,7 +20,6 @@ linkTitle: Cards
```
{{</* cards */>}}
{{</* card link="/" title="Callout" icon="warning" */>}}
{{</* card link="/" title="GitHub" icon="github" */>}}
{{</* card link="/" title="No Icon" */>}}
{{</* /cards */>}}
```

View File

@ -2,7 +2,6 @@
"htmlElements": {
"tags": [
"a",
"abbr",
"article",
"aside",
"blockquote",
@ -33,7 +32,6 @@
"li",
"link",
"main",
"mark",
"meta",
"nav",
"ol",
@ -502,7 +500,6 @@
"transition-colors",
"transition-opacity",
"transition-transform",
"typesetting-article",
"underline",
"underline-offset-2",
"w-3.5",

View File

@ -4,6 +4,7 @@
<article class="w-full break-words flex min-h-[calc(100vh-4rem)] min-w-0 justify-center pb-8 pr-[calc(env(safe-area-inset-right)-1.5rem)]">
<main class="w-full min-w-0 max-w-6xl px-6 pt-4 md:px-12">
<h1 class="text-4xl tracking-tighter text-center font-extrabold md:text-5xl mt-8 pb-6">{{ .Title }}</h1>
<div class="content">{{ .Content }}</div>
{{ range .Pages.ByDate }}
<div class="mb-10">
<h3><a style="color: inherit; text-decoration: none;" class="block font-semibold mt-8 text-2xl " href="{{ .RelPermalink }}">{{ .Title }}</a></h3>