Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

config.title, config.description not passed to translated pages #1634

Closed
tkarkkainen opened this issue Oct 6, 2021 · 3 comments
Closed

config.title, config.description not passed to translated pages #1634

tkarkkainen opened this issue Oct 6, 2021 · 3 comments
Labels
documentation done in pr Already done in a PR

Comments

@tkarkkainen
Copy link

Bug Report

Environment

Zola version: 0.14.1

Expected Behavior

In the attached site, with zola serve, opening http://127.0.0.1:1111/ should provide the following information:

lang: fi
section.title: Default language section
config.title: Default language title
config.description: Default language description

and http://127.0.0.1:1111/en should provide the following information:

lang: en
section.title: English section
config.title: Translated English title
config.description: Translated English description

zola-debug-site.tar.gz

Current Behavior

http://127.0.0.1:1111/ works as expected, but http://127.0.0.1:1111/en/gives the following:

lang: en
section.title: English section
config.title: 
config.description: 

Step to reproduce

See the attached zola site: zola-debug-site.tar.gz

Or check the main files in the example below:

The template:

<html>
<head></head>
<body>
	<pre>
		lang: {{ lang }}
		section.title: {{ section.title }}
		config.title: {{ config.title }}
		config.description: {{ config.description }}
	</pre>
</body>

config.toml:

# The URL the site will be built for
base_url = "https://example.com"

title = "Default language title"
description = "Default language description"
default_language="fi"

# Whether to automatically compile all Sass files in the sass directory
compile_sass = false

# Whether to build a search index to be used later on by a JavaScript library
build_search_index = false

[languages.en]
generate_feed = true
build_search_index = true

[languages.en.translations]
title = "Translated English title"
description = "Translated English description"

[markdown]
# Whether to do syntax highlighting
# Theme can be customised by setting the `highlight_theme` variable to a theme supported by Zola
highlight_code = false

[extra]
# Put all your custom variables here
@scria1000
Copy link
Contributor

I think your config is wrong, just format your config.toml according to the doc: https://www.getzola.org/documentation/getting-started/configuration/

[languages]

[languages.en]
generate_feed = true
build_search_index = true
title = "Translated English title"
description = "Translated English description"

[languages.de]
generate_feed = true
build_search_index = false
title = "Translated German title"
description = "Translated German description"

@tkarkkainen
Copy link
Author

Thanks for the quick reply @scria1000. You're right: your suggested change to the config works. I was following the docs at https://www.getzola.org/documentation/content/multilingual/ which misled me to the config I originally used. So perhaps this should be treated as an error in the documentation? Are the [languages.code.translations] sections used for anything?

@Keats
Copy link
Collaborator

Keats commented Oct 6, 2021

The language.code.translations are used for languages other than the default one. For the default one it's just a plain [translations] at the top. The docs are not clear about that and should be improved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation done in pr Already done in a PR
Projects
None yet
Development

No branches or pull requests

3 participants