Skip to content

Commit

Permalink
feat: add v1 of the website
Browse files Browse the repository at this point in the history
  • Loading branch information
williamdes committed May 30, 2020
1 parent bc7a5bf commit 399322b
Show file tree
Hide file tree
Showing 18 changed files with 186 additions and 0 deletions.
17 changes: 17 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
url: "https://long-term.support/"
baseurl: "/" # a subpath, e.g. /admin
title: "Long Term Support"
sass:
sass_dir: assets/css

defaults:
#languages
- scope:
path: ""
values:
lang: "en"
layout: default
- scope:
path: "fr"
values:
lang: "fr"
8 changes: 8 additions & 0 deletions _data/languages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
en:
label: English
icon: 🇺🇸
url: '%baseurl%%lang%%path%'
fr:
label: Français
icon: 🇫🇷
url: '%baseurl%%lang%%path%'
6 changes: 6 additions & 0 deletions _data/map.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

- en: en/contact.html
fr: fr/contact.html

- en: en/index.html
fr: fr/index.html
8 changes: 8 additions & 0 deletions _data/navbar.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
home:
path: '%lang%/index.html'
url: '%baseurl%%lang%/index.html'
translation-key: 'home'
contact:
path: '%lang%/contact.html'
url: '%baseurl%%lang%/contact.html'
translation-key: 'contact'
26 changes: 26 additions & 0 deletions _data/translations.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
header:
toggle-menu:
fr: "Déplier le menu"
en: "Toggle Menu"

brand:
fr: "Support Long Terme"
en: "Long Term Support"

navbar:
home:
fr: "Accueil"
en: "Home"
contact:
fr: "Contact"
en: "Contact"

homepage:
motd:
fr: "Support Long Terme"
en: "Long Term Support"

contact:
title:
fr: "Contact"
en: "Contact"
17 changes: 17 additions & 0 deletions _includes/alternate.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{%- for block in site.data.map -%}
{%- for item in block[page.lang] -%}
{%- if item == page.path -%}
{%- for trans in block -%}
{%- assign trans_path = trans[1] -%}
{%- assign posts = site.posts | where:"path", trans_path -%}
{%- for item in posts %}
<link rel="alternate" hreflang="{{item.lang}}" href="{{item.url|absolute_url}}" />
{%- endfor %}
{%- assign pages = site.pages | where:"path", trans_path -%}
{%- for item in pages %}
<link rel="alternate" hreflang="{{item.lang}}" href="{{item.url|absolute_url}}" />
{%- endfor %}
{%- endfor %}
{%- endif %}
{%- endfor %}
{%- endfor %}
1 change: 1 addition & 0 deletions _includes/footer.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!-- {{lang}} - {{page.lang-ref}} -->
12 changes: 12 additions & 0 deletions _includes/head.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>{{ page.title }} - {{ site.title }}</title>

<link rel="stylesheet" href="{{ "/assets/css/main.css" | relative_url }}">
{%- include alternate.html %}
{%- if page.canonical and page.path %}
<link rel="canonical" href="{{page.path|absolute_url}}" />
{%- endif %}
</head>
28 changes: 28 additions & 0 deletions _includes/navbar.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<span class="navbar-brand mb-0 h1">{{ trans.header.brand[lang] }}</span>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavDropdown"
aria-controls="navbarNavDropdown" aria-expanded="false" aria-label="{{ trans.header.toggle-menu[lang] }}">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNavDropdown">
<ul class="navbar-nav">
{% for nav in site.data.navbar %}
{%- assign navitem = nav[1] -%}
{%- assign url = navitem.url | replace:'%lang%', lang | replace: '%baseurl%', site.baseurl -%}
{%- assign path = navitem.path | replace:'%lang%', lang | replace: '%baseurl%', site.baseurl -%}
<li class="nav-item{%- if page.path == path %} active{%- endif -%}">
<a class="nav-link" href="{{ url }}">{{ trans.header.navbar[navitem.translation-key][lang] }}</a>
</li>
{% endfor %}
</ul>
</div>
<form class="form-inline my-2 my-lg-0">
<ul class="list-group list-group-horizontal">
{% for lang in site.data.languages %}
{%- assign language = lang[1] -%}
<li class="list-group-item"><a href="{{ language.url | replace:'%path%', page.path-key | replace:'%lang%', lang[0] | replace: '%baseurl%', site.baseurl }}" hreflang="{{ lang[0] }}">{{language.icon}} {{ language.label }}</a>
</li>
{% endfor %}
</ul>
</form>
</nav>
10 changes: 10 additions & 0 deletions _includes/pages/contact.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

{%- include trans.html -%}
<div class="container">
<div class="row">
<div class="col">
<h1 class="text-primary text-center">{{trans.contact.title[lang]}}</h1>
<p></p>
</div>
</div>
</div>
10 changes: 10 additions & 0 deletions _includes/pages/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

{%- include trans.html -%}
<div class="container">
<div class="row">
<div class="col">
<h1 class="text-primary text-center">{{trans.homepage.motd[lang]}}</h1>
<p></p>
</div>
</div>
</div>
2 changes: 2 additions & 0 deletions _includes/trans.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{%- assign trans = site.data.translations -%}
{% assign lang = page.lang | default: site.lang | default: 'en' -%}
10 changes: 10 additions & 0 deletions _layouts/default.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!DOCTYPE html>
{% include trans.html -%}
<html lang="{{ lang }}">
{% include head.html %}
<body>
{% include navbar.html %}
{{ content }}
{% include footer.html %}
</body>
</html>
7 changes: 7 additions & 0 deletions en/contact.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
lang-ref: contact
path: en/contact.html
path-key: /contact.html
title: "Contact"
---
{% include pages/contact.html %}
8 changes: 8 additions & 0 deletions en/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
lang-ref: index
path: en/index.html
path-key: /index.html
title: "Homepage"
canonical: true
---
{% include pages/index.html %}
7 changes: 7 additions & 0 deletions fr/contact.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
lang-ref: contact
path: fr/contact.html
path-key: /contact.html
title: "Contact"
---
{% include pages/contact.html %}
8 changes: 8 additions & 0 deletions fr/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
lang-ref: index
path: fr/index.html
path-key: /index.html
title: "Accueil"
canonical: true
---
{% include pages/index.html %}
1 change: 1 addition & 0 deletions index.html

0 comments on commit 399322b

Please sign in to comment.