Skip to content

Commit 16ad03c

Browse files
committed
move stuff to _includes
1 parent 1bfc347 commit 16ad03c

File tree

7 files changed

+39
-81
lines changed

7 files changed

+39
-81
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99
1. Add to `_data/locales/languages.yml`
1010
2. Make sure `_data/locales/default/xx.json` is fully translated
1111
3. Make sure `_data/locales/sidebar/xx.yml` exists
12-
4. Copy pages and change front matter for `lang`
12+
4. Copy `index.md` and change front matter for `lang`
13+
14+
Note that untranslated pages should not exist. If a page is untranslated the UI will defualt to the english page (unless linked to).
1315

1416
#### Making alert box
1517

_includes/lang-messages.html

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<!-- Outdated translatons notice -->
2+
{% if page.ver %}
3+
{% assign enPage=site.pages | where:"stub", page.stub | where:"lang", "en" | first %}
4+
{% if page.ver < enPage.ver %}
5+
<div class="alert alert-warning" role="alert">
6+
<h4 class="alert-heading">{{ i18n.warning }}</h4>
7+
<p>{{ i18n.outdated-warn-1 }} <a class="alert-link"
8+
href="{{ enPage.url | prepend: site.url }}">{{ i18n.outdated-warn-2 }}</a>
9+
{{ i18n.outdated-warn-3 }}</p>
10+
<hr>
11+
<p class="mb-0"><a class="alert-link"
12+
href="https://crowdin.com/project/authenticator-docs/">{{ i18n.translate-long }}</a>
13+
</p>
14+
</div>
15+
{% endif %}
16+
{% endif %}
17+
<!-- This page is avalible in {{ language }} -->
18+
<div class="alert alert-primary" id="lang-change-div" style="display: none;" role="alert">
19+
<a id="lang-change-a" class="alert-link"></a> <span id="lang-change-text"></span>
20+
</div>

_includes/nav.html

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<nav class="navbar navbar-expand-lg navbar-light bg-light">
2+
<a class="navbar-brand" href="/">
3+
<img src="/assets/logo/logo.svg" width="30" height="30" class="d-inline-block align-top">
4+
{{ site.title }}
5+
</a>
6+
<div class="navbar-nav ml-auto">
7+
<a class="nav-item nav-link" href="https://github.com/Authenticator-Extension">GitHub</a>
8+
</div>
9+
</nav>
10+
<br>

_layouts/default.html

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,7 @@
1919
</head>
2020

2121
<body>
22-
<nav class="navbar navbar-expand-lg navbar-light bg-light">
23-
<a class="navbar-brand" href="/">
24-
<img src="/assets/logo/logo.svg" width="30" height="30" class="d-inline-block align-top">
25-
{{ site.title }}
26-
</a>
27-
<div class="navbar-nav ml-auto">
28-
<a class="nav-item nav-link" href="https://github.com/Authenticator-Extension">GitHub</a>
29-
</div>
30-
</nav>
31-
<br>
22+
{% include nav.html %}
3223
<div class="container">
3324
<div class="row">
3425
{% if page.stub %}
@@ -69,26 +60,7 @@
6960
<div class="col-8">
7061
<h1>{{ page.title }}</h1>
7162
<hr>
72-
<!-- Outdated translatons notice -->
73-
{% if page.ver %}
74-
{% assign enPage=site.pages | where:"stub", page.stub | where:"lang", "en" | first %}
75-
{% if page.ver < enPage.ver %}
76-
<div class="alert alert-warning" role="alert">
77-
<h4 class="alert-heading">{{ i18n.warning }}</h4>
78-
<p>{{ i18n.outdated-warn-1 }} <a class="alert-link"
79-
href="{{ enPage.url | prepend: site.url }}">{{ i18n.outdated-warn-2 }}</a>
80-
{{ i18n.outdated-warn-3 }}</p>
81-
<hr>
82-
<p class="mb-0"><a class="alert-link" href="https://crowdin.com/project/authenticator-docs/">{{ i18n.translate-long }}</a>
83-
</p>
84-
</div>
85-
{% endif %}
86-
{% endif %}
87-
<!-- This page is avalible in {{ language }} -->
88-
<div class="alert alert-primary" id="lang-change-div" style="display: none;" role="alert">
89-
<a id="lang-change-a" class="alert-link"></a> <span id="lang-change-text"></span>
90-
</div>
91-
<!-- -->
63+
{% include lang-messages.html %}
9264
{{ content }}
9365
<hr>
9466
<!-- Footer -->

_layouts/docs-index.html

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,7 @@
1111
</head>
1212

1313
<body>
14-
<nav class="navbar navbar-expand-lg navbar-light bg-light">
15-
<a class="navbar-brand" href="/">
16-
<img src="/assets/logo/logo.svg" width="30" height="30" class="d-inline-block align-top">
17-
{{ site.title }}
18-
</a>
19-
<div class="navbar-nav ml-auto">
20-
<a class="nav-item nav-link" href="https://github.com/Authenticator-Extension">GitHub</a>
21-
</div>
22-
</nav>
23-
<br>
14+
{% include nav.html %}
2415
<div class="container">
2516
<!-- BODY -->
2617
{% assign sidebar = site.data.locales.sidebar[page.lang].sections | default: site.data.locales.sidebar.en.sections %}

_layouts/docs-lang-select.html

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,7 @@
1111
</head>
1212

1313
<body>
14-
<nav class="navbar navbar-expand-lg navbar-light bg-light">
15-
<a class="navbar-brand" href="/">
16-
<img src="/assets/logo/logo.svg" width="30" height="30" class="d-inline-block align-top">
17-
{{ site.title }}
18-
</a>
19-
<div class="navbar-nav ml-auto">
20-
<a class="nav-item nav-link" href="https://github.com/Authenticator-Extension">GitHub</a>
21-
</div>
22-
</nav>
23-
<br>
14+
{% include nav.html %}
2415
<div class="container">
2516
<!-- BODY -->
2617
<h1>Pick language:</h1>

_layouts/no-sidebar.html

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -19,40 +19,12 @@
1919
</head>
2020

2121
<body>
22-
<nav class="navbar navbar-expand-lg navbar-light bg-light">
23-
<a class="navbar-brand" href="/">
24-
<img src="/assets/logo/logo.svg" width="30" height="30" class="d-inline-block align-top">
25-
{{ site.title }}
26-
</a>
27-
<div class="navbar-nav ml-auto">
28-
<a class="nav-item nav-link" href="https://github.com/Authenticator-Extension">GitHub</a>
29-
</div>
30-
</nav>
31-
<br>
22+
{% include nav.html %}
3223
<div class="container">
3324
<div class="col">
3425
<h1>{{ page.title }}</h1>
3526
<hr>
36-
<!-- Outdated translatons notice -->
37-
{% if page.ver %}
38-
{% assign enPage=site.pages | where:"stub", page.stub | where:"lang", "en" | first %}
39-
{% if page.ver < enPage.ver %}
40-
<div class="alert alert-warning" role="alert">
41-
<h4 class="alert-heading">{{ i18n.warning }}</h4>
42-
<p>{{ i18n.outdated-warn-1 }} <a class="alert-link"
43-
href="{{ enPage.url | prepend: site.url }}">{{ i18n.outdated-warn-2 }}</a>
44-
{{ i18n.outdated-warn-3 }}</p>
45-
<hr>
46-
<p class="mb-0"><a class="alert-link"
47-
href="https://crowdin.com/project/authenticator-docs/">{{ i18n.translate-long }}</a>
48-
</p>
49-
</div>
50-
{% endif %}
51-
{% endif %}
52-
<!-- This page is avalible in {{ language }} -->
53-
<div class="alert alert-primary" id="lang-change-div" style="display: none;" role="alert">
54-
<a id="lang-change-a" class="alert-link"></a> <span id="lang-change-text"></span>
55-
</div>
27+
{% include lang-messages.html %}
5628
{{ content }}
5729
{% assign pages=site.pages | where:"stub", page.stub | sort: 'lang' %}
5830
{% if pages.size > 1 %}

0 commit comments

Comments
 (0)