picocms / Pico

Pico is a stupidly simple, blazing fast, flat file CMS.
http://picocms.org/
MIT License
3.83k stars 615 forks source link

How to I specify ISO language code? #569

Closed BelleNottelling closed 3 years ago

BelleNottelling commented 3 years ago

Hello, I'm currently rebuilding my website with Pico and it's a really nice simple software, but I can't figure out how I can specify the language of the webpage? With HTML it would just be but I can't seem to find a solution for it (other than just adding HTML)

<html lang="en">
PhrozenByte commented 3 years ago

Simply use a custom meta header, e.g. in Markdown files

---
title: My example page
lang: en
---

Some content

and in your Twig template

<html lang="{{ meta.lang }}">
<!-- … -->

You could even use a config option as fallback by adding the following to your config/config.yml

theme_config:
  lang: en

and something like the following in your Twig template

<html lang="{{ meta.lang ?? config.theme_config.lang }}">
<!-- … -->

This way you don't have to add the lang meta header to your pages, but rely on a default value.

BelleNottelling commented 3 years ago

That perfectly answers my question. Thank you!

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in two days if no further activity occurs. Thank you for your contributions! :+1: