Skip to content
Grav 2.0 is officially stable. Read the announcement →
Archive

Set <html lang="de">

Started by Muut Archive 10 years ago · 15 replies · 921 views
10 years ago

How can I set <html lang="de">? It 's blank at the moment with this output -> <html lang="">

10 years ago

I don't use multilanguage at the moment. I have tested multilanguage on a test system and it added /de to the domain. It also renamed the page names. I would like to avoid those larger modifications if possible. I don't know how important this setting is at all.

10 years ago

use the following code snippet to setup german as default language and to avoid the additional /deinside the url:

YAML

languages:
  supported:
    - de
  include_default_lang: false
  translations: true
---
10 years ago

I'm using onepage skeleton. Should I insert the snippet into each page?

10 years ago

I 've found it in /user/config/system.yaml and added and modified the existing code. Here's the content which doesn't work yet.

languages:
supported:

  • de
    include_default_lang: false
    translations: true
    translations_fallback: true
    session_store_active: false
    http_accept_language: false
    override_locale: false
10 years ago

It should already be working with the System configuration you posted.

10 years ago

With Antimatter it's not possible that lang is blank, as it has

<html lang="{{ grav.language.getLanguage ?: 'en' }}">

in the file templates/partials/base.html.twig, so it's either your language, or en.

10 years ago

I 'm using big-picture. It says: <html lang="{{ grav.language.getActive ?: theme_config.default_lang }}">

10 years ago

Should I just copy the line from antimatter and purge the one from big-picture?&quest;

10 years ago

this works:

languages:
supported:
– de
includedefaultlang: true
translations: true
translationsfallback: true
sessionstoreactive: false
httpacceptlanguage: false
overridelocale: false

10 years ago

no, it doesn't work. It adds another /de and the W3C Validator cannot check it

10 years ago

taking the snippet from antimatter does the job
No /de but correct language markup :-)

10 years ago

Ok it should use grav.language.getLanguage not grav.language.getActive, open an issue on that theme GitHub repository so the developer knows there's a problem with it.

10 years ago

I thought you were using Antimatter as you mentioned the one-page site skeleton

10 years ago

I will do. Sorry for not mentioning the theme.

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1359 9 years ago
Archive · by Muut Archive, 9 years ago
2 936 9 years ago
Archive · by Muut Archive, 9 years ago
2 4066 9 years ago
Archive · by Muut Archive, 9 years ago
1 2955 9 years ago
Archive · by Muut Archive, 9 years ago
3 1121 9 years ago