Skip to content

Commit

Permalink
page_lang
Browse files Browse the repository at this point in the history
  • Loading branch information
junsan1 committed Jun 24, 2024
1 parent 9dbb89c commit abd2911
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
2 changes: 1 addition & 1 deletion _includes/breadcrumbs.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="{{ '/' | append: page.lang | relative_url }}">{{ locale.home | default: "Home" }}</a></li>
<li class="breadcrumb-item"><a href="{{ '/' | append: page_lang | relative_url }}">{{ locale.home | default: "Home" }}</a></li>
{% assign crumbs = page.url | remove: '/index.html' | split: '/' %}
{% for crumb in crumbs offset: 1 %}
{% if forloop.last %}
Expand Down
24 changes: 14 additions & 10 deletions _layouts/base.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
{% assign locale = site.pages | where: "path", page.lang | map: "locales" | first %}
{% assign page_lang = page.url | split: '/' | first %}
{% if page_lang == '' or page_lang == nil %}
{% assign page_lang = 'en' %}
{% endif %}
{% assign locale = site.pages | where: "path", page_lang | map: "locales" | first %}
<!DOCTYPE html>
<html lang="{{ page.lang | default: site.lang | default: "en" }}">
<html lang="{{ page_lang }}">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
Expand All @@ -12,7 +16,7 @@
<body>
<header id="sticky-header">
<div class="logo">
<a href="{{ "/" | append: page.lang | relative_url }}">
<a href="{{ "/" | append: page_lang | relative_url }}">
<img src="{{ "/assets/images/logo.png" | relative_url }}" alt="AlgoTradingLib Logo">
</a>
</div>
Expand All @@ -23,17 +27,17 @@
</button>
<nav>
<ul>
<li><a href="/{{ page.lang }}">{{ locale.home | default: "Home" }}</a></li>
<li><a href="{{ '/software' | prepend: '/' | prepend: page.lang | relative_url }}">{{ locale.software | default: "Software" }}</a></li>
<li><a href="/{{ page.lang }}/brokers">{{ locale.brokers | default: "Brokers" }}</a></li>
<li><a href="{{ base_url }}pedia">{{ locale.algopedia | default: "Algopedia" }}</a></li>
<li><a href="/{{ page_lang }}">{{ locale.home | default: "Home" }}</a></li>
<li><a href="/{{ page_lang }}/soft">{{ locale.software | default: "Software" }}</a></li>
<li><a href="/{{ page_lang }}/brokers">{{ locale.brokers | default: "Brokers" }}</a></li>
<li><a href="/{{ page_lang }}/pedia">{{ locale.algopedia | default: "Algopedia" }}</a></li>
</ul>
</nav>
<div class="language-selector">
<select id="lang-select">
<option value="en" {% if page.lang == "en" %}selected{% endif %}>English</option>
<option value="ru" {% if page.lang == "ru" %}selected{% endif %}>Русский</option>
<option value="zh" {% if page.lang == "zh" %}selected{% endif %}>中文</option>
<option value="en" {% if page_lang == "en" %}selected{% endif %}>English</option>
<option value="ru" {% if page_lang == "ru" %}selected{% endif %}>Русский</option>
<option value="zh" {% if page_lang == "zh" %}selected{% endif %}>中文</option>
</select>
</div>
</header>
Expand Down
2 changes: 1 addition & 1 deletion _layouts/letter_index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<h1>{{ page.title }}</h1>

<ul>
{% assign letter_posts = site.pages | where_exp: "item", "item.path contains page.lang" | where_exp: "item", "item.path contains page.section" | where_exp: "item", "item.path contains page.letter" %}
{% assign letter_posts = site.pages | where_exp: "item", "item.path contains page_lang" | where_exp: "item", "item.path contains page.section" | where_exp: "item", "item.path contains page.letter" %}
{% assign sorted_posts = letter_posts | sort: "title" %}
{% for post in sorted_posts %}
{% assign filename = post.path | split: '/' | last %}
Expand Down

0 comments on commit abd2911

Please sign in to comment.