diff options
author | EuAndreh <eu@euandre.org> | 2020-08-12 06:34:38 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2020-08-12 06:56:04 -0300 |
commit | 191728a2cac217e96a7f1e4e9a4710606f6ad920 (patch) | |
tree | bbcf9c17bb3bd462f8d1c41169d1122b08161d18 /_layouts | |
parent | assert-content.sh: Look at post refs too, not only pages (diff) | |
download | euandre.org-191728a2cac217e96a7f1e4e9a4710606f6ad920.tar.gz euandre.org-191728a2cac217e96a7f1e4e9a4710606f6ad920.tar.xz |
Add TILs section, with Atom support and i18n
- add i18n logic to support translated TIL entries and listing;
- make the website title less tied to a blog: "EuAndreh::blog" ->
<web>EuAndreh</web>;
- remove old Atom feed link aliases;
- remove feed.all.atom and it's link in the about page;
- create Atom feed for TIL entries;
- show blog and TIL Atom feed on their listing pages (index and tils-listing);
- add root alias: / -> /en/
- remove explicit list of feeds from $IGNORED_PAGES and use a '*.atom' glob
instead;
- also lint, assert-content and assert-unique-ref of TILs;
- fix wrong "post.date" in pastebin entry in site.json;
Diffstat (limited to '_layouts')
-rw-r--r-- | _layouts/default.html | 46 | ||||
-rw-r--r-- | _layouts/index.html | 7 | ||||
-rw-r--r-- | _layouts/til.html | 11 | ||||
-rw-r--r-- | _layouts/tils-listing.html | 18 |
4 files changed, 61 insertions, 21 deletions
diff --git a/_layouts/default.html b/_layouts/default.html index 6a0587b..f97f5ef 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -5,7 +5,7 @@ <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="/styles.css"> - <link rel="alternate" type="application/atom+xml" href="{{ site.t.feed_url[page.lang] }}" title="{{ site.t.feed_title[page.lang] }}" /> + <link rel="alternate" type="application/atom+xml" href="{{ site.t.feed_url[page.lang] }}" title="{{ site.t.feed.title[page.lang] }}" /> <title>{{ page.title }}</title> <meta property="og:site_name" content="{{ site.title }}" /> @@ -29,29 +29,35 @@ </div> <div id="nav-right"> {% if page.ref != nil %} - {% if site.posts.size > 0 or site.pages.size > 0 %} - <ul> - {% assign lposts=site.posts | where:"ref", page.ref | sort: 'lang' %} - {% for lpost in lposts %} - <li> - <a href="{{ lpost.url }}" class="{{ lpost.lang }}">{{ lpost.lang }}</a> - </li> - {% endfor %} + <ul> + {% assign lposts=site.posts | where:"ref", page.ref | sort: 'lang' %} + {% for lpost in lposts %} + <li> + <a href="{{ lpost.url }}" class="{{ lpost.lang }}">{{ lpost.lang }}</a> + </li> + {% endfor %} + {% if page.ref == "root" %} + {% assign lpages=site.pages | where:"ref", "index" | sort: 'lang' %} + {% else %} {% assign lpages=site.pages | where:"ref", page.ref | sort: 'lang' %} - {% for lpage in lpages %} - <li> - <a href="{{ lpage.url }}" class="{{ lpage.lang }}">{{ lpage.lang }}</a> - </li> - {% endfor %} - </ul> - {% endif %} - {% endif %} + {% endif %} + {% for lpage in lpages %} + <li> + <a href="{{ lpage.url }}" class="{{ lpage.lang }}">{{ lpage.lang }}</a> + </li> + {% endfor %} + {% assign ltils=site.tils | where:"ref", page.ref | sort: 'lang' %} + {% for ltil in ltils %} + <li> + <a href="{{ ltil.url }}" class="{{ ltil.lang }}">{{ ltil.lang }}</a> + </li> + {% endfor %} + </ul> + {% endif %} + <a href="{{ site.t.til_url[page.lang] }}">{{ site.t.til[page.lang] }}</a> <a href="{{ site.t.about_url[page.lang] }}">{{ site.t.about[page.lang] }}</a> - <a href="{{ site.t.feed_url[page.lang] }}"> - <img class="simple-icon" src="/images/atom.svg" alt="{{ site.t.alt.blog_feed[page.lang] }}" /> - </a> </div> </nav> </header> diff --git a/_layouts/index.html b/_layouts/index.html index 0ec683d..1ce99ca 100644 --- a/_layouts/index.html +++ b/_layouts/index.html @@ -1,7 +1,12 @@ --- layout: default --- -<h1>{{ site.t.recent_posts[page.lang] }}</h1> +<h1> + {{ site.t.recent_posts[page.lang] }} + <a href="{{ site.t.feed.url.blog[page.lang] }}"> + <img class="simple-icon" src="/images/atom.svg" alt="{{ site.t.alt.atom[page.lang] }}" /> + </a> +</h1> {% assign lposts=site.posts | where:"lang", page.lang | sort: 'date' | reverse %} {% if lposts.size > 0 %} <ul> diff --git a/_layouts/til.html b/_layouts/til.html new file mode 100644 index 0000000..1a70d3b --- /dev/null +++ b/_layouts/til.html @@ -0,0 +1,11 @@ +--- +layout: default +--- +<article> + <section class="header"> + {{ site.t.posted_on[page.lang] }} {{ page.date | date: site.t.date_format[page.lang] }} + </section> + <section> + {{ content }} + </section> +</article> diff --git a/_layouts/tils-listing.html b/_layouts/tils-listing.html new file mode 100644 index 0000000..e254125 --- /dev/null +++ b/_layouts/tils-listing.html @@ -0,0 +1,18 @@ +--- +layout: default +--- +<h1> + {{ site.t.til_listing[page.lang] }} + <a href="{{ site.t.feed.url.til[page.lang] }}"> + <img class="simple-icon" src="/images/atom.svg" alt="{{ site.t.alt.atom[page.lang] }}" /> + </a> +</h1> +{{ content }} +<ul> + {% assign tils = site.tils | where:"lang", page.lang | sort: "date" | reverse %} + {%- for til in tils -%} + <li> + <a href="{{ til.url | relative_url }}">{{ til.title | escape }}</a> - {{ til.date | date: site.t.date_format[page.lang] }} + </li> + {%- endfor -%} +</ul> |