Enable RSS and make sure the links are localized
parent
c16eed1a18
commit
0323206585
12
README.md
12
README.md
|
@ -101,6 +101,15 @@ If you wish to directly extract the contents of a localized page, without any re
|
||||||
{{ widgets::i18n_content(path="@/blog/_index.md") }}
|
{{ widgets::i18n_content(path="@/blog/_index.md") }}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Localized URL
|
||||||
|
|
||||||
|
If you need to get the localized URI for path on the website, you can use the i18n_url macro which acts as a wrapper around the [get_url](https://www.getzola.org/documentation/templates/overview/#get-url) function, passing it the relevant lang context:
|
||||||
|
|
||||||
|
```
|
||||||
|
{% import "widgets.html" as widgets %}
|
||||||
|
<a href="{{ widgets:i18n_uri(path = "rss.xml") }}">RSS</a>
|
||||||
|
```
|
||||||
|
|
||||||
# TODO
|
# TODO
|
||||||
|
|
||||||
If something is missing for you, please open an issue.
|
If something is missing for you, please open an issue.
|
||||||
|
@ -113,9 +122,10 @@ If something is missing for you, please open an issue.
|
||||||
- [x] pages
|
- [x] pages
|
||||||
- [x] blogposts
|
- [x] blogposts
|
||||||
- [x] other strings in the templates
|
- [x] other strings in the templates
|
||||||
|
- [x] localized RSS links
|
||||||
- [ ] links to navigate between languages
|
- [ ] links to navigate between languages
|
||||||
- [ ] other
|
- [ ] other
|
||||||
- [ ] ASCII banner does not overflow
|
- [ ] ASCII banner does not overflow
|
||||||
- [ ] write setup/configuration guide
|
- [ ] write setup/configuration guide
|
||||||
- [ ] reference water.css semantic styling
|
- [ ] reference water.css semantic styling
|
||||||
- [ ] RSS links
|
- [x] RSS links
|
||||||
|
|
|
@ -11,6 +11,8 @@ highlight_code = false
|
||||||
# Whether to build a search index to be used later on by a JavaScript library
|
# Whether to build a search index to be used later on by a JavaScript library
|
||||||
build_search_index = false
|
build_search_index = false
|
||||||
|
|
||||||
|
generate_rss = true
|
||||||
|
|
||||||
default_language = "en"
|
default_language = "en"
|
||||||
|
|
||||||
languages = [
|
languages = [
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf8">
|
<meta charset="utf8">
|
||||||
<title>{{ config.extra.title }}</title>
|
<title>{{ config.extra.title }}</title>
|
||||||
<link rel="alternate" type="application/rss+xml" href="{{ get_url(path="rss.xml") }}">
|
<link rel="alternate" type="application/rss+xml" href="{{ widgets::i18n_url(path="rss.xml") }}">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<link rel="stylesheet" href="{{ get_url(path="style.css") }}" type="text/css">
|
<link rel="stylesheet" href="{{ get_url(path="style.css") }}" type="text/css">
|
||||||
<link rel="stylesheet" href="{{ get_url(path="water.css") }}" type="text/css">
|
<link rel="stylesheet" href="{{ get_url(path="water.css") }}" type="text/css">
|
||||||
|
|
|
@ -42,3 +42,9 @@ a submenu. A submenu is an actual list
|
||||||
{%- macro i18n_content(path) -%}
|
{%- macro i18n_content(path) -%}
|
||||||
{{ get_page(path=self::i18n_path(path=path)) | get(key="content") }}
|
{{ get_page(path=self::i18n_path(path=path)) | get(key="content") }}
|
||||||
{%- endmacro i18n_content -%}
|
{%- endmacro i18n_content -%}
|
||||||
|
|
||||||
|
{%- macro i18n_url(path) -%}
|
||||||
|
{%- if lang == config.default_language -%}{{ get_url(path=path) }}
|
||||||
|
{%- else -%}
|
||||||
|
{%- set p = lang ~ "/" ~ path -%}{{ get_url(path=p) }}{%- endif -%}
|
||||||
|
{%- endmacro i18n_url -%}
|
||||||
|
|
Loading…
Reference in New Issue