exampleSite: arrr, let pirrrates rrread sites from subfolder with canonifyURLs=false #163

This commit is contained in:
Sören Weber 2022-02-06 01:58:32 +01:00
parent fbd431c613
commit 676ba8a7bb
No known key found for this signature in database
GPG key ID: 07D17FF580AE7589
7 changed files with 17 additions and 12 deletions

View file

@ -134,4 +134,4 @@ landingPageName = "<i class='fas fa-home'></i> Home"
The home button is going to look like this:
![Default Home Button](/basics/configuration/images/home_button_defaults.png?width=100%)
![Default Home Button](images/home_button_defaults.png?width=100%)

View file

@ -57,7 +57,7 @@ The Relearn theme let you choose between some predefined color scheme variants,
themeVariant = ""
```
![Red variant](/basics/customization/images/standard-variant.png?width=60pc)
![Red variant](images/standard-variant.png?width=60pc)
### Red variant
@ -67,7 +67,7 @@ The Relearn theme let you choose between some predefined color scheme variants,
themeVariant = "red"
```
![Red variant](/basics/customization/images/red-variant.png?width=60pc)
![Red variant](images/red-variant.png?width=60pc)
### Blue variant
@ -77,7 +77,7 @@ The Relearn theme let you choose between some predefined color scheme variants,
themeVariant = "blue"
```
![Blue variant](/basics/customization/images/blue-variant.png?width=60pc)
![Blue variant](images/blue-variant.png?width=60pc)
### Green variant
@ -87,7 +87,7 @@ The Relearn theme let you choose between some predefined color scheme variants,
themeVariant = "green"
```
![Green variant](/basics/customization/images/green-variant.png?width=60pc)
![Green variant](images/green-variant.png?width=60pc)
### 'Mine variant

View file

@ -48,7 +48,7 @@ Discover what this Hugo theme is all about and the core concepts behind it.
renders as
![A Chapter](/basics/installation/images/chapter.png?classes=shadow&width=60pc)
![A Chapter](images/chapter.png?classes=shadow&width=60pc)
The Relearn theme provides archetypes to create skeletons for your website. Begin by creating your first chapter page with the following command

View file

@ -8,4 +8,4 @@ Thanks to the simplicity of Hugo, this page is as empty as this theme needs requ
Just download latest version of [Hugo binary](https://gohugo.io/getting-started/installing/) for your OS (Windows, Linux, Mac) : it's that simple.
![Magic](/basics/requirements/images/magic.gif?classes=shadow)
![Magic](images/magic.gif?classes=shadow)

View file

@ -11,7 +11,7 @@ It provides:
- Automatic menu generation from multilingual content
- In-browser language switching
![I18n menu](/cont/i18n/images/i18n-menu.gif)
![I18n menu](images/i18n-menu.gif)
## Basic configuration

View file

@ -46,7 +46,7 @@ The Relearn theme defines two types of pages. *Default* and *Chapter*. Both can
A **Chapter** displays a page meant to be used as introduction for a set of child pages. Commonly, it contains a simple title and a catch line to define content that can be found under it.
You can define any HTML as prefix for the menu. In the example below, it's just a number but that could be an [icon](https://fortawesome.github.io/Font-Awesome/).
![Chapter page](/cont/pages/images/pages-chapter.png?width=50pc)
![Chapter page](images/pages-chapter.png?width=50pc)
```markdown
+++
@ -67,7 +67,7 @@ To tell the Relearn theme to consider a page as a chapter, set `chapter=true` in
A **Default** page is any other content page.
![Default page](/cont/pages/images/pages-default.png?width=50pc)
![Default page](images/pages-default.png?width=50pc)
```toml
+++
@ -131,7 +131,7 @@ pre = "<i class='fab fa-github'></i> "
+++
```
![Title with icon](/cont/pages/images/frontmatter-icon.png)
![Title with icon](images/frontmatter-icon.png)
### Ordering sibling menu/page entries

View file

@ -1,5 +1,7 @@
{{- $langsrc := .Get 1 | default "en" }}
{{- $langtrg := .Page.Language.Lang }}
{{- $baseURL := urls.Parse .Site.BaseURL }}
{{- $baseURLpath := $baseURL.Path | default "/" }}
{{- $words := dict
"Hugo" "Cap'n Hugo"
"Info" "Ahoi"
@ -70,7 +72,7 @@
"(\\w)(?:[aeiou])mizes([\\s\\n<.,;?!:])" "'mizes"
"(\\w)(?:[aeiou])nize([\\s\\n<.,;?!:])" "'nize"
"(\\w)(?:[aeiou])nizes([\\s\\n<.,;?!:])" "'nizes"
"(.)=\"/([^\".]*?\")" (printf "=\"/%s/" $langtrg)
(printf "(.)=\"%s([^\"]*?\")" $baseURLpath) (printf "=\"%s%s/" $baseURLpath $langtrg)
}}
{{- $fix := dict
"warn'n" "warning"
@ -82,6 +84,7 @@
{{- $c := "" }}
{{- range .Page.Translations }}
{{- if eq .Language.Lang $langsrc }}
{{- $l := .RelPermalink }}
{{- $c = .Content }}
{{- range $from, $to := $words }}
{{- $c = replaceRE (printf "([\\s\\n>])%s([\\s\\n<.,;?!:])" $from) (printf "${1}%s${2}" $to) $c }}
@ -92,6 +95,8 @@
{{- range $from, $to := $fix }}
{{ $c = replace $c $from $to }}
{{- end }}
{{- $c = replaceRE "(src|href)=\"(images/[^\"]*?\")" (printf "${1}=\"%s${2}" $l) $c }}
{{- $c = replaceRE "(src|href)=\"([^\"]*?)/pir/([^\"]*?.files/[^\"]*?\")" "${1}=\"${2}/${3}" $c }}
{{- end }}
{{- end }}
{{- $c | safeHTML }}