Skip to content

Commit

Permalink
Render the resource with localised title and language selector
Browse files Browse the repository at this point in the history
  • Loading branch information
b-n committed Oct 26, 2024
1 parent 7deaee4 commit 29263de
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions _layouts/resource.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,28 @@
---
layout: default
---
<!-- {% assign author = site.data.authors[page.author] | default: site.data.authors.techwerkers %} -->
{% comment %}
We need a custom language selector since the page slug is not localised and doesn't use namespace
{% endcomment %}
<div align="right">
{% for lang in site.languages %}
{% if site.lang == lang %}
<b>{% t langs.{{ lang }} %}</b>
{% else %}
{% assign page_url = '/' | append: lang | append: page.url %}
<a href="{{ page_url }}">{% t langs.{{ lang }} %}</a>
{% endif %}
{% endfor %}
</div>

{% assign localised_title_key = 'title_' | append: site.lang %}
{% assign author = site.data.authors[page.author] | default: site.data.authors.techwerkers %}
{% assign page_title = page[localised_title_key] | default: page.title %}

<article class="post">
<header class="post-header">
<a href="/resources">{% t 'home.resources.more' %}</a>
<h1 class="post-title">{{ page.title | escape }}</h1>
<header class="post">
<a href="{% tl resources %}">{% t 'home.resources.more' %}</a>
<h1 class="post-title">{{ page_title }}</h1>
<section class="l-stack -horizontal -space-large">
{% if author.picture %}
<img
Expand Down

0 comments on commit 29263de

Please sign in to comment.