From e40de080c312f38b692ff687fa10be66951223dc Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Wed, 5 Feb 2020 01:42:23 -0300 Subject: WIP Jekyll --- _layouts/default.html | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 _layouts/default.html (limited to '_layouts/default.html') diff --git a/_layouts/default.html b/_layouts/default.html new file mode 100644 index 0000000..fc9befd --- /dev/null +++ b/_layouts/default.html @@ -0,0 +1,46 @@ + + + + + + + + + {%- seo -%} + + +
+ +
+ +
+ {{ content }} +
+ + + + -- cgit v1.2.3 From de9473df009bdab19ea287af8b18b6c141c2749b Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Wed, 5 Feb 2020 02:17:01 -0300 Subject: Reproduce hakyll behaviour --- Gemfile | 1 - _config.yml | 3 ++ _layouts/default.html | 3 +- _layouts/index.html | 38 ++++------------------ _layouts/page.html | 10 +----- _layouts/pastebin.html | 11 +++++++ _layouts/pastebins.html | 38 ++++------------------ _layouts/post.html | 36 ++++++++------------ _pastebins | 1 + .../2018-08-01-verifying-npm-ci-reproducibility.md | 5 +-- ...g-youtube-dl-to-manage-youtube-subscriptions.md | 2 +- pastebins/failure-on-guix-tex-live-importer.md | 8 +++-- pastebins/inconsistent-hash-of-buildgomodule.md | 6 +++- pastebins/nix-exps.md | 6 +++- pastebins/nix-show-derivation.md | 6 +++- pastebins/raku-tuple-type-annotation.md | 6 +++- 16 files changed, 76 insertions(+), 104 deletions(-) create mode 100644 _layouts/pastebin.html create mode 120000 _pastebins (limited to '_layouts/default.html') diff --git a/Gemfile b/Gemfile index 6eead05..413f583 100644 --- a/Gemfile +++ b/Gemfile @@ -1,7 +1,6 @@ source "https://rubygems.org" gem "jekyll" -# gem "minima" group :jekyll_plugins do gem "jekyll-feed" diff --git a/_config.yml b/_config.yml index 595377c..a5385ff 100644 --- a/_config.yml +++ b/_config.yml @@ -27,3 +27,6 @@ exclude: - vendor/ - spelling/ - scripts/ + +collections: + - pastebins diff --git a/_layouts/default.html b/_layouts/default.html index fc9befd..9fa116e 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -16,7 +16,7 @@ @@ -24,6 +24,7 @@
+

{{ page.title }}

{{ content }}
diff --git a/_layouts/index.html b/_layouts/index.html index 8f8ac79..675d9e0 100644 --- a/_layouts/index.html +++ b/_layouts/index.html @@ -1,34 +1,10 @@ --- layout: default --- - -
- {%- if page.title -%} -

{{ page.title }}

- {%- endif -%} - - {{ content }} - - {%- if site.posts.size > 0 -%} -

{{ page.list_title | default: "Posts" }}

-
    - {%- for post in site.posts -%} -
  • - {%- assign date_format = site.minima.date_format | default: "%b %-d, %Y" -%} - -

    - - {{ post.title | escape }} - -

    - {%- if site.show_excerpts -%} - {{ post.excerpt }} - {%- endif -%} -
  • - {%- endfor -%} -
- -

subscribe via RSS

- {%- endif -%} - -
+ diff --git a/_layouts/page.html b/_layouts/page.html index 01e4b2a..57116c1 100644 --- a/_layouts/page.html +++ b/_layouts/page.html @@ -2,13 +2,5 @@ layout: default ---
- -
-

{{ page.title | escape }}

-
- -
- {{ content }} -
- + {{ content }}
diff --git a/_layouts/pastebin.html b/_layouts/pastebin.html new file mode 100644 index 0000000..51194d7 --- /dev/null +++ b/_layouts/pastebin.html @@ -0,0 +1,11 @@ +--- +layout: default +--- +
+
+ Posted on {{ page.date | date: "%b %-d, %Y" }} +
+
+ {{ content }} +
+
diff --git a/_layouts/pastebins.html b/_layouts/pastebins.html index 0740a04..6b7830c 100644 --- a/_layouts/pastebins.html +++ b/_layouts/pastebins.html @@ -1,34 +1,10 @@ --- layout: default --- - -
- {%- if page.title -%} -

{{ page.title }}

- {%- endif -%} - - {{ content }} - - {%- if site.posts.size > 0 -%} -

{{ page.list_title | default: "Posts" }}

-
    - {%- for post in site.posts -%} -
  • - {%- assign date_format = site.minima.date_format | default: "%b %-d, %Y" -%} - -

    - - {{ post.title | escape }} - -

    - {%- if site.show_excerpts -%} - {{ post.excerpt }} - {%- endif -%} -
  • - {%- endfor -%} -
- -

subscribe via RSS

- {%- endif -%} - -
+ diff --git a/_layouts/post.html b/_layouts/post.html index abf9696..bdaa3f8 100644 --- a/_layouts/post.html +++ b/_layouts/post.html @@ -1,27 +1,19 @@ --- layout: default --- -
- -
-

{{ page.title | escape }}

- -
- -
+
+
+ Posted on {{ page.date | date: "%b %-d, %Y" }} +
+
{{ content }} -
- - {%- if site.disqus.shortname -%} - {%- include disqus_comments.html -%} - {%- endif -%} - - + +
+

Have a comment on this post? Start a discussion + in my public inbox + by sending an email to ~euandreh/public-inbox@lists.sr.ht + [mailing list etiquette], + or see existing discussions. +

+
diff --git a/_pastebins b/_pastebins new file mode 120000 index 0000000..e0bcac8 --- /dev/null +++ b/_pastebins @@ -0,0 +1 @@ +pastebins \ No newline at end of file diff --git a/_posts/2018-08-01-verifying-npm-ci-reproducibility.md b/_posts/2018-08-01-verifying-npm-ci-reproducibility.md index 5f6954b..efb5fea 100644 --- a/_posts/2018-08-01-verifying-npm-ci-reproducibility.md +++ b/_posts/2018-08-01-verifying-npm-ci-reproducibility.md @@ -1,8 +1,9 @@ --- -title: Verifying \npm ci\ reproducibility +title: Verifying "npm ci" reproducibility date: 2018-08-01 layout: post ---- When +--- +When [npm\@5](https://blog.npmjs.org/post/161081169345/v500) came bringing [package-locks](https://docs.npmjs.com/files/package-locks) with it, I was confused about the benefits it provided, since running `npm install` diff --git a/_posts/2018-12-21-using-youtube-dl-to-manage-youtube-subscriptions.md b/_posts/2018-12-21-using-youtube-dl-to-manage-youtube-subscriptions.md index c548146..21b6686 100644 --- a/_posts/2018-12-21-using-youtube-dl-to-manage-youtube-subscriptions.md +++ b/_posts/2018-12-21-using-youtube-dl-to-manage-youtube-subscriptions.md @@ -1,5 +1,5 @@ --- -title: Using \youtube-dl\ to manage YouTube subscriptions +title: Using "youtube-dl" to manage YouTube subscriptions date: 2018-12-21 layout: post --- diff --git a/pastebins/failure-on-guix-tex-live-importer.md b/pastebins/failure-on-guix-tex-live-importer.md index 410d768..5280c38 100644 --- a/pastebins/failure-on-guix-tex-live-importer.md +++ b/pastebins/failure-on-guix-tex-live-importer.md @@ -1,6 +1,10 @@ ---- title: Failure on Guix TeX Live importer date: 2020-01-04 --- +--- +title: Failure on Guix TeX Live importer +date: 2020-01-04 +layout: pastebin +--- -``` {.shell .numberLines startFrom=""} +```shell $ guix import texlive fontspec redirection vers « https://ctan.org/xml/1.2/pkg/fontspec »... Backtrace: diff --git a/pastebins/inconsistent-hash-of-buildgomodule.md b/pastebins/inconsistent-hash-of-buildgomodule.md index 3cdc823..87663c5 100644 --- a/pastebins/inconsistent-hash-of-buildgomodule.md +++ b/pastebins/inconsistent-hash-of-buildgomodule.md @@ -1,4 +1,8 @@ ---- title: Inconsistent hash of buildGoModule date: 2019-06-08 --- +--- +title: Inconsistent hash of buildGoModule +date: 2019-06-08 +layout: pastebin +--- [FIXED](https://discourse.nixos.org/t/inconsistent-hash-of-buildgomodule/3127/2). The [commit that made this diff --git a/pastebins/nix-exps.md b/pastebins/nix-exps.md index 426d681..d2ad658 100644 --- a/pastebins/nix-exps.md +++ b/pastebins/nix-exps.md @@ -1,4 +1,8 @@ ---- title: Nix Stuff date: 2018-07-25 --- +--- +title: Nix Stuff +date: 2018-07-25 +layout: pastebin +--- ``` {.nix .numberLines startFrom=""} let diff --git a/pastebins/nix-show-derivation.md b/pastebins/nix-show-derivation.md index 2daec81..d60d443 100644 --- a/pastebins/nix-show-derivation.md +++ b/pastebins/nix-show-derivation.md @@ -1,4 +1,8 @@ ---- title: nix show-derivation sample output date: 2018-07-25 --- +--- +title: nix show-derivation sample output +date: 2018-07-25 +layout: pastebin +--- ``` {.nix .numberLines startFrom=""} $ nix show-derivation /nix/store/zzz9cl2ly0mb2njr7vwa5528fxmn29m8-combofont-0.2.drv diff --git a/pastebins/raku-tuple-type-annotation.md b/pastebins/raku-tuple-type-annotation.md index 6d5957f..cdd387e 100644 --- a/pastebins/raku-tuple-type-annotation.md +++ b/pastebins/raku-tuple-type-annotation.md @@ -1,4 +1,8 @@ ---- title: Raku tuple type annotation date: 2019-12-29 --- +--- +title: Raku tuple type annotation +date: 2019-12-29 +layout: pastebin +--- ``` {.raku .numberLines startFrom=""} # Single Str return value: this works -- cgit v1.2.3 From 847789edcf135f38b27f8f6ac3a85386037e4e38 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Wed, 5 Feb 2020 16:23:08 -0300 Subject: Add manual support for multiple languages --- 404.html | 4 +-- Gemfile | 1 - TODOs.org | 13 ++++++--- _config.yml | 45 +++++++++++++++++++++++++++--- _layouts/default.html | 38 +++++++++++++++++++------ _layouts/index.html | 10 ++++--- _layouts/post.html | 23 +++++++++++---- _posts/2018-07-17-rodando-guix-on-nixos.md | 8 ++++++ _posts/2018-07-17-running-guix-on-nixos.md | 2 ++ about.md | 2 ++ default.nix | 24 ++-------------- index.md | 2 ++ pt/index.md | 5 ++++ sobre.md | 7 +++++ styles.css | 10 +++++++ 15 files changed, 143 insertions(+), 51 deletions(-) create mode 100644 _posts/2018-07-17-rodando-guix-on-nixos.md create mode 100644 pt/index.md create mode 100644 sobre.md (limited to '_layouts/default.html') diff --git a/404.html b/404.html index c472b4e..1edf1a0 100644 --- a/404.html +++ b/404.html @@ -19,6 +19,6 @@ layout: default

404

-

Page not found :(

-

The requested page could not be found.

+

Page not found

+

Página não encontrada

diff --git a/Gemfile b/Gemfile index 413f583..5b81e13 100644 --- a/Gemfile +++ b/Gemfile @@ -5,5 +5,4 @@ gem "jekyll" group :jekyll_plugins do gem "jekyll-feed" gem "jekyll-seo-tag" - # gem "jekyll-multiple-languages-plugin" end diff --git a/TODOs.org b/TODOs.org index 16998df..3b94187 100644 --- a/TODOs.org +++ b/TODOs.org @@ -1,6 +1,11 @@ * Tasks -** TODO Translate articles -https://groups.google.com/forum/#!topic/hakyll/KAhCO1GVELA -** TODO Spelling -** i18n page +** Spelling ** i18n Feed title +** config.yml +** kramdown -> commonmark +** https://github.com/planetjekyll/awesome-jekyll-plugins/ +** change file naming strategy +use subfolders? +** Fix date formatting +** add sitemap +https://www.sylvaindurand.org/making-jekyll-multilingual/ diff --git a/_config.yml b/_config.yml index 0439307..2462bfd 100644 --- a/_config.yml +++ b/_config.yml @@ -1,3 +1,4 @@ +--- title: Your awesome title email: your-email@example.com description: >- @@ -7,13 +8,10 @@ description: >- baseurl: "" url: "url.com" -markdown: kramdown # FIXME +markdown: kramdown plugins: - jekyll-feed - jekyll-seo-tag - # - jekyll-multiple-languages-plugin - -# languages: ["en", "fr"] exclude: - Gemfile @@ -21,6 +19,7 @@ exclude: - gemset.nix - README - TODOs.org + - LICENSE - default.nix - utils.nix - shell.nix @@ -31,3 +30,41 @@ exclude: collections: pastebins: output: true + +t: + about: + en: "About" + pt: "Sobre" + home: + en: "EuAndreh's blog" + pt: "Blog do EuAndreh" + recent_posts: + en: 'Recent posts' + pt: 'Postagens recentes' + feed_title: + en: "EuAndreh's Feed" + pt: "Feed do EuAndreh" + feed_url: + en: '/feed.en.xml' + pt: '/feed.pt.xml' + date_format: + en: '%b %-d, %Y' + pt: '%b %-d, %Y' + posted_on: + en: 'Posted on' + pt: 'Postado em' + alt: + blog_feed: + en: 'Blog feed' + pt: 'Feed do blog' + envelope_icon: + en: 'Envelope icon' + pt: 'Ícone de envelope' + lock_icon: + en: 'Lock icon' + pt: 'Ícone de fechadura' + footer: + en: >- + The content for this site is licensed under <a rel="license" href="https://creativecommons.org/licenses/by-sa/4.0/">CC-BY-SA</a>. The <a href="https://git.sr.ht/~euandreh/website">code</a> is <a href="https://git.sr.ht/~euandreh/website/tree/master/LICENSE">GPLv3 or later</a>. + pt: >- + O conteúdo desse site é licensiado sob a licença <a rel="license" href="https://creativecommons.org/licenses/by-sa/4.0/">CC-BY-SA</a>. O <a href="https://git.sr.ht/~euandreh/website">código</a> é <a href="https://git.sr.ht/~euandreh/website/tree/master/LICENSE">GPLv3 ou versões maiores</a>. diff --git a/_layouts/default.html b/_layouts/default.html index 9fa116e..53b9830 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -1,23 +1,43 @@ <!DOCTYPE html> -<html lang="{{ page.lang | default: site.lang | default: "en" }}"> +<html lang="{{ page.lang | default: "en" }}"> <head> <meta charset="UTF-8"> <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="/feed.xml" title="EuAndreh's Feed" /> + <link rel="alternate" type="application/atom+xml" href="{{ site.t.feed_url[page.lang] }}" title="{{ site.t.feed_title[page.lang] }}" /> {%- seo -%} </head> <body> <header> <nav> <div id="nav-left"> - <a href="/">EuAndreh's blog</a> + <a href="/">{{ site.t.home[page.lang] }}</a> </div> <div id="nav-right"> - <a href="/about.html">About</a> - <a href="/feed.xml"> - <img class="simple-icon" src="/images/atom.svg" alt="Blog feed" /> + <ul> + {% if page.ref != nil %} + {% 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 %} + {% endif %} + + {% if page.ref != nil %} + {% 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 %} + {% endif %} + </ul> + + <a href="/about.html">{{ 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> @@ -31,16 +51,16 @@ <footer> <ul> <li> - <img class="simple-icon" src="/images/envelope.svg" alt="Envelope icon" /> + <img class="simple-icon" src="/images/envelope.svg" alt="{{ site.t.alt.envelope_icon[page.lang] }}" /> <a href="mailto:eu@euandre.org">eu@euandre.org</a> </li> <li> - <img class="simple-icon" src="/images/lock.svg" alt="Lock icon" /> + <img class="simple-icon" src="/images/lock.svg" alt="{{ site.t.alt.lock_icon[page.lang] }}" /> <a href="/public-key.txt">81F90EC3CD356060</a> </li> </ul> <p> - The content for this site is licensed under <a rel="license" href="https://creativecommons.org/licenses/by-sa/4.0/">CC-BY-SA</a>. The <a href="https://git.sr.ht/~euandreh/website">code</a> is <a href="https://git.sr.ht/~euandreh/website/tree/master/LICENSE">GPLv3 or later</a>. + {{ site.t.footer[page.lang] }} </p> </footer> </body> diff --git a/_layouts/index.html b/_layouts/index.html index 2c44ece..5b45898 100644 --- a/_layouts/index.html +++ b/_layouts/index.html @@ -1,11 +1,13 @@ --- layout: default --- -<h1>Recent posts</h1> +<h1>{{ site.t.recent_posts[page.lang] }}</h1> <ul> {%- for post in site.posts -%} - <li> - <a href="{{ post.url }}">{{ post.title | escape }}</a> - {{ post.date | date: "%b %-d, %Y" }} - </li> + {% if post.lang == page.lang %} + <li> + <a href="{{ post.url }}">{{ post.title | escape }}</a> - {{ post.date | date: "%b %-d, %Y" }} + </li> + {% endif %} {%- endfor -%} </ul> diff --git a/_layouts/post.html b/_layouts/post.html index bdaa3f8..b1b1412 100644 --- a/_layouts/post.html +++ b/_layouts/post.html @@ -3,17 +3,28 @@ layout: default --- <article> <section class="header"> - Posted on {{ page.date | date: "%b %-d, %Y" }} + {{ site.t.posted_on[page.lang] }} {{ page.date | date: site.t.date_format[page.lang] }} </section> <section> {{ content }} </section> <section> - <p>Have a comment on this post? Start a discussion - in my <a href="https://lists.sr.ht/~euandreh/public-inbox">public inbox</a> - by sending an email to <a href="mailto:~euandreh/public-inbox@lists.sr.ht?Subject=Re%3A%20{{ page.title | escape }}">~euandreh/public-inbox@lists.sr.ht</a> - [<a href="https://man.sr.ht/lists.sr.ht/etiquette.md">mailing list etiquette</a>], - or see <a href="https://lists.sr.ht/~euandreh/public-inbox?search={{ page.title | escape }}">existing discussions</a>. + <p> + {% if page.lang == 'en' %} + Have a comment on this post? Start a discussion in my + <a href="https://lists.sr.ht/~euandreh/public-inbox">public inbox</a> + by sending an email to + <a href="mailto:~euandreh/public-inbox@lists.sr.ht?Subject=Re%3A%20{{ page.title | escape }}">~euandreh/public-inbox@lists.sr.ht</a> + [<a href="https://man.sr.ht/lists.sr.ht/etiquette.md">mailing list etiquette</a>], + or see <a href="https://lists.sr.ht/~euandreh/public-inbox?search={{ page.title | escape }}">existing discussions</a>. + {% elsif page.lang == 'pt' %} + Tem um comentário sobre essa postagem? Comece uma discussão na minha + <a href="https://lists.sr.ht/~euandreh/public-inbox">caixa de entrada pública</a> + mandando um email para + <a href="mailto:~euandreh/public-inbox@lists.sr.ht?Subject=Re%3A%20{{ page.title | escape }}">~euandreh/public-inbox@lists.sr.ht</a> + [<a href="https://man.sr.ht/lists.sr.ht/etiquette.md">etiqueta da lista de email</a> (em inglês)], + ou procure por <a href="https://lists.sr.ht/~euandreh/public-inbox?search={{ page.title | escape }}">discussões existentes</a>. + {% endif %} </p> </section> </article> diff --git a/_posts/2018-07-17-rodando-guix-on-nixos.md b/_posts/2018-07-17-rodando-guix-on-nixos.md new file mode 100644 index 0000000..b449541 --- /dev/null +++ b/_posts/2018-07-17-rodando-guix-on-nixos.md @@ -0,0 +1,8 @@ +--- +title: Rodando Guix no NixOS +date: 2018-07-17 +layout: post +lang: pt +ref: running-guix-on-nixos +--- +Eu queria rodar Guix numa máquina com NixOS instalado. diff --git a/_posts/2018-07-17-running-guix-on-nixos.md b/_posts/2018-07-17-running-guix-on-nixos.md index 69a9d1a..c0d4611 100644 --- a/_posts/2018-07-17-running-guix-on-nixos.md +++ b/_posts/2018-07-17-running-guix-on-nixos.md @@ -2,6 +2,8 @@ title: Running Guix on NixOS date: 2018-07-17 layout: post +lang: en +ref: running-guix-on-nixos --- I wanted to run Guix on a NixOS machine. Even though the Guix manual explains how to do diff --git a/about.md b/about.md index 8c89b1b..f78e7d7 100644 --- a/about.md +++ b/about.md @@ -1,6 +1,8 @@ --- layout: page title: About +lang: en +ref: about --- Hi, I\'m EuAndreh. I write software and occasionally music. You can find my contact information in the footer of this page, or mail my [public diff --git a/default.nix b/default.nix index 78d2ce9..e79da46 100644 --- a/default.nix +++ b/default.nix @@ -13,37 +13,19 @@ in rec { gemset = ./gemset.nix; }; subtasks = rec { - hunspellCheck = utils.baseTask.overrideAttrs (baseAttrs: { - name = "${baseAttrs.name}-hunspell"; - buildInputs = baseAttrs.buildInputs - ++ [ (pkgs.hunspellWithDicts (with pkgs.hunspellDicts; [ en-us ])) ]; - buildPhase = '' - patchShebangs . - ./spelling/check-spelling.sh "${subtasks.docs}" - touch $out - ''; - }); docs = utils.baseTask.overrideAttrs (baseAttrs: { name = "${baseAttrs.name}-docs"; - src = ./site; - buildInputs = [ ]; + buildInputs = [ jekyllEnv ]; buildPhase = '' - export LOCALE_ARCHIVE="${pkgs.glibcLocales}/lib/locale/locale-archive"; - export LANG=en_US.UTF-8 - build-site build mkdir $out - cp -r _site/* $out + jekyll build -d $out ''; }); }; test = utils.test [ utils.formatNix (utils.shellcheck null) - (utils.fixme [ "pastebin/skeleton.org" "utils.nix" ]) - subtasks.perlPodCheck - subtasks.batsTest - subtasks.perlInternalTest - subtasks.hunspellCheck + (utils.fixme null) ]; shell = pkgs.mkShell rec { name = "website-shell"; diff --git a/index.md b/index.md index f6278f0..28cca27 100644 --- a/index.md +++ b/index.md @@ -1,3 +1,5 @@ --- layout: index +lang: en +ref: index --- diff --git a/pt/index.md b/pt/index.md new file mode 100644 index 0000000..2285152 --- /dev/null +++ b/pt/index.md @@ -0,0 +1,5 @@ +--- +layout: index +lang: pt +ref: index +--- diff --git a/sobre.md b/sobre.md new file mode 100644 index 0000000..ec3d3df --- /dev/null +++ b/sobre.md @@ -0,0 +1,7 @@ +--- +layout: page +title: Sobre +lang: pt +ref: about +--- +Oi, eu sou EuAndreh. diff --git a/styles.css b/styles.css index eb4bb78..94270d9 100644 --- a/styles.css +++ b/styles.css @@ -25,6 +25,16 @@ nav a { text-decoration: none; } +nav ul, nav li { + display: inline; +} + +nav ul li a { + color: black; + font-size: 14px; + margin: 6px; +} + footer { border-top: solid 2px black; font-size: 14px; -- cgit v1.2.3 From a6ae95d8bd0e9a933160fed6381b215d19d817ee Mon Sep 17 00:00:00 2001 From: EuAndreh <eu@euandre.org> Date: Wed, 5 Feb 2020 22:05:04 -0300 Subject: DIY Atom feed --- 404.html | 24 ------ Gemfile | 3 +- Gemfile.lock | 3 - TODOs.org | 3 +- _config.yml | 15 ++-- _includes/feed.atom | 97 ++++------------------ _layouts/default.html | 2 +- .../2018-08-01-verifying-npm-ci-reproducibility.md | 3 + ...g-youtube-dl-to-manage-youtube-subscriptions.md | 2 + _posts/2019-06-02-stateless-os.md | 2 + feed.en.atom | 3 + feed.pt.atom | 3 + gemset.nix | 11 --- pastebins.md | 2 + scripts/assert-content.sh | 85 +++++++++++++++++++ site.json | 26 ++++++ sitemap.xml | 29 +++++++ 17 files changed, 183 insertions(+), 130 deletions(-) delete mode 100644 404.html create mode 100644 feed.en.atom create mode 100644 feed.pt.atom create mode 100755 scripts/assert-content.sh create mode 100644 site.json create mode 100644 sitemap.xml (limited to '_layouts/default.html') diff --git a/404.html b/404.html deleted file mode 100644 index 1edf1a0..0000000 --- a/404.html +++ /dev/null @@ -1,24 +0,0 @@ ---- -layout: default ---- - -<style type="text/css" media="screen"> - .container { - margin: 10px auto; - max-width: 600px; - text-align: center; - } - h1 { - margin: 30px 0; - font-size: 4em; - line-height: 1; - letter-spacing: -1px; - } -</style> - -<div class="container"> - <h1>404</h1> - - <p><strong>Page not found</strong></p> - <p><strong>Página não encontrada</strong></p> -</div> diff --git a/Gemfile b/Gemfile index 5b81e13..3ed43f3 100644 --- a/Gemfile +++ b/Gemfile @@ -3,6 +3,5 @@ source "https://rubygems.org" gem "jekyll" group :jekyll_plugins do - gem "jekyll-feed" - gem "jekyll-seo-tag" + gem "jekyll-seo-tag" # FIXME end diff --git a/Gemfile.lock b/Gemfile.lock index 3516df2..65a43b5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -27,8 +27,6 @@ GEM pathutil (~> 0.9) rouge (>= 1.7, < 4) safe_yaml (~> 1.0) - jekyll-feed (0.13.0) - jekyll (>= 3.7, < 5.0) jekyll-sass-converter (1.5.2) sass (~> 3.4) jekyll-seo-tag (2.6.1) @@ -60,7 +58,6 @@ PLATFORMS DEPENDENCIES jekyll - jekyll-feed jekyll-seo-tag BUNDLED WITH diff --git a/TODOs.org b/TODOs.org index 3b94187..8bcfd2c 100644 --- a/TODOs.org +++ b/TODOs.org @@ -1,6 +1,5 @@ * Tasks ** Spelling -** i18n Feed title ** config.yml ** kramdown -> commonmark ** https://github.com/planetjekyll/awesome-jekyll-plugins/ @@ -9,3 +8,5 @@ use subfolders? ** Fix date formatting ** add sitemap https://www.sylvaindurand.org/making-jekyll-multilingual/ +** Indent XML and HTML +** Drafts in feed diff --git a/_config.yml b/_config.yml index 2462bfd..382eec0 100644 --- a/_config.yml +++ b/_config.yml @@ -1,17 +1,14 @@ --- -title: Your awesome title -email: your-email@example.com -description: >- - Write an awesome description for your new site here. You can edit this - line in _config.yml. It will appear in your document head meta (for - Google search results) and in your feed.xml site description. -baseurl: "" -url: "url.com" +title: EuAndreh::blog +url: "https://euandre.org" +author: + name: EuAndreh + email: eu@euandre.org markdown: kramdown plugins: - - jekyll-feed - jekyll-seo-tag +# FIXME: remove plugins exclude: - Gemfile diff --git a/_includes/feed.atom b/_includes/feed.atom index 4d4fd16..f4243ea 100644 --- a/_includes/feed.atom +++ b/_includes/feed.atom @@ -1,96 +1,35 @@ -<?xml version="1.0" encoding="utf-8"?> -{% if page.xsl %} - <?xml-stylesheet type="text/xml" href="{{ '/feed.xslt.xml' | absolute_url }}"?> -{% endif %} -<feed xmlns="http://www.w3.org/2005/Atom" {% if site.lang %}xml:lang="{{ site.lang }}"{% endif %}> - <generator uri="https://jekyllrb.com/" version="{{ jekyll.version }}">Jekyll</generator> +<?xml version="1.0" encoding="UTF-8"?> +<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="{{ include.lang }}"> <link href="{{ page.url | absolute_url }}" rel="self" type="application/atom+xml" /> - <link href="{{ '/' | absolute_url }}" rel="alternate" type="text/html" {% if site.lang %}hreflang="{{ site.lang }}" {% endif %}/> + <link href="{{ '/' | absolute_url }}" rel="alternate" type="text/html" hreflang="{{ include.lang }}" /> <updated>{{ site.time | date_to_xmlschema }}</updated> <id>{{ page.url | absolute_url | xml_escape }}</id> - {% assign title = site.title | default: site.name %} - {% if page.collection != "posts" %} - {% assign collection = page.collection | capitalize %} - {% assign title = title | append: " | " | append: collection %} - {% endif %} - {% if page.category %} - {% assign category = page.category | capitalize %} - {% assign title = title | append: " | " | append: category %} - {% endif %} + <title type="html">{{ site.title | smartify | xml_escape }} + {{ site.t.feed_title[include.lang] | smartify | xml_escape }} - {% if title %} - {{ title | smartify | xml_escape }} - {% endif %} + + {{ site.author.name | xml_escape }} + {{ site.author.email | xml_escape }} + - {% if site.description %} - {{ site.description | xml_escape }} - {% endif %} - - {% if site.author %} - - {{ site.author.name | default: site.author | xml_escape }} - {% if site.author.email %} - {{ site.author.email | xml_escape }} - {% endif %} - {% if site.author.uri %} - {{ site.author.uri | xml_escape }} - {% endif %} - - {% endif %} - - {% assign posts = site[page.collection] | where_exp: "post", "post.draft != true" | sort: "date" | reverse %} - {% if page.category %} - {% assign posts = posts | where: "category",page.category %} - {% endif %} - {% for post in posts limit: 10 %} - + {% assign posts = site.posts | where:"lang", include.lang | sort: "date" | reverse %} + {% for post in posts %} + {{ post.title | smartify | strip_html | normalize_whitespace | xml_escape }} {{ post.date | date_to_xmlschema }} - {{ post.last_modified_at | default: post.date | date_to_xmlschema }} - {{ post.id | absolute_url | xml_escape }} - {% assign excerpt_only = post.feed.excerpt_only | default: site.feed.excerpt_only %} - {% unless excerpt_only %} - {{ post.content | strip | xml_escape }} - {% endunless %} + {{ post.updated_at | default: post.date | date_to_xmlschema }} + {{ post.url | absolute_url | xml_escape }} - {% assign post_author = post.author | default: post.authors[0] | default: site.author %} - {% assign post_author = site.data.authors[post_author] | default: post_author %} - {% assign post_author_email = post_author.email | default: nil %} - {% assign post_author_uri = post_author.uri | default: nil %} - {% assign post_author_name = post_author.name | default: post_author %} + {{ post.content | strip | xml_escape }} - {{ post_author_name | default: "" | xml_escape }} - {% if post_author_email %} - {{ post_author_email | xml_escape }} - {% endif %} - {% if post_author_uri %} - {{ post_author_uri | xml_escape }} - {% endif %} + {{ site.author.name | xml_escape }} + {{ site.author.email | xml_escape }} - {% if post.category %} - - {% endif %} - - {% for tag in post.tags %} - - {% endfor %} - - {% if post.excerpt and post.excerpt != empty %} - {{ post.excerpt | strip_html | normalize_whitespace | xml_escape }} - {% endif %} - - {% assign post_image = post.image.path | default: post.image %} - {% if post_image %} - {% unless post_image contains "://" %} - {% assign post_image = post_image | absolute_url %} - {% endunless %} - - - {% endif %} + {{ post.excerpt | strip_html | normalize_whitespace | xml_escape }} {% endfor %} diff --git a/_layouts/default.html b/_layouts/default.html index 53b9830..bd253c8 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -6,7 +6,7 @@ - {%- seo -%} +
diff --git a/_posts/2018-08-01-verifying-npm-ci-reproducibility.md b/_posts/2018-08-01-verifying-npm-ci-reproducibility.md index efb5fea..dcfdd75 100644 --- a/_posts/2018-08-01-verifying-npm-ci-reproducibility.md +++ b/_posts/2018-08-01-verifying-npm-ci-reproducibility.md @@ -2,6 +2,9 @@ title: Verifying "npm ci" reproducibility date: 2018-08-01 layout: post +lang: en +ref: veryfing-npm-ci-reproducibility +updated_at: 2019-05-22 --- When [npm\@5](https://blog.npmjs.org/post/161081169345/v500) came bringing diff --git a/_posts/2018-12-21-using-youtube-dl-to-manage-youtube-subscriptions.md b/_posts/2018-12-21-using-youtube-dl-to-manage-youtube-subscriptions.md index 21b6686..b58aee9 100644 --- a/_posts/2018-12-21-using-youtube-dl-to-manage-youtube-subscriptions.md +++ b/_posts/2018-12-21-using-youtube-dl-to-manage-youtube-subscriptions.md @@ -2,6 +2,8 @@ title: Using "youtube-dl" to manage YouTube subscriptions date: 2018-12-21 layout: post +lang: en +ref: using-youtube-dl-to-manage-youtube-subscriptions --- I\'ve recently read the [announcement](https://www.reddit.com/r/DataHoarder/comments/9sg8q5/i_built_a_selfhosted_youtube_subscription_manager/) diff --git a/_posts/2019-06-02-stateless-os.md b/_posts/2019-06-02-stateless-os.md index 64e74f7..486a0c2 100644 --- a/_posts/2019-06-02-stateless-os.md +++ b/_posts/2019-06-02-stateless-os.md @@ -2,6 +2,8 @@ title: Using NixOS as an stateless workstation date: 2019-06-02 layout: post +lang: en +ref: stateless-os --- Last week[^1] I changed back to an old[^2] Samsung laptop, and installed [NixOS](https://nixos.org/) on it. diff --git a/feed.en.atom b/feed.en.atom new file mode 100644 index 0000000..643f557 --- /dev/null +++ b/feed.en.atom @@ -0,0 +1,3 @@ +--- +--- +{% include feed.atom lang="en" %} \ No newline at end of file diff --git a/feed.pt.atom b/feed.pt.atom new file mode 100644 index 0000000..39a9248 --- /dev/null +++ b/feed.pt.atom @@ -0,0 +1,3 @@ +--- +--- +{% include feed.atom lang="pt" %} diff --git a/gemset.nix b/gemset.nix index 23e26a2..4c38b33 100644 --- a/gemset.nix +++ b/gemset.nix @@ -103,17 +103,6 @@ }; version = "3.8.5"; }; - jekyll-feed = { - dependencies = ["jekyll"]; - groups = ["default"]; - platforms = []; - source = { - remotes = ["https://rubygems.org"]; - sha256 = "1lx8nvkhd8l1wm3b6s506rycwbmpbzbsbjl65p21asjz6vbwf1ir"; - type = "gem"; - }; - version = "0.13.0"; - }; jekyll-sass-converter = { dependencies = ["sass"]; groups = ["default"]; diff --git a/pastebins.md b/pastebins.md index e2d95c6..24083f9 100644 --- a/pastebins.md +++ b/pastebins.md @@ -1,3 +1,5 @@ --- layout: pastebins-listing +lang: en +ref: pastebins --- diff --git a/scripts/assert-content.sh b/scripts/assert-content.sh new file mode 100755 index 0000000..a55e9b0 --- /dev/null +++ b/scripts/assert-content.sh @@ -0,0 +1,85 @@ +#!/usr/bin/env bash +set -Eeuo pipefail + +JSON="${1:-}" +[[ -z "${JSON}" ]] && { + echo 'Missing input JSON file.' + exit 2 +} + +contains-element() { + local e match="$1" + shift + for e; do [[ "$e" == "$match" ]] && return 0; done + return 1 +} + +fail-attr() { + ATTRIBUTE="${1}" + URL="${2}" + red "Undefined '${ATTRIBUTE}' for ${URL}." >&2 + exit 1 +} + +LANGS=(en pt) +assert-frontmatter() { + F="${1}" + LANG="$(echo "$F" | base64 --decode | jq -r .lang)" + REF="$(echo "$F" | base64 --decode | jq -r .ref)" + URL="$(echo "$F" | base64 --decode | jq -r .url)" + [[ -z "${LANG}" ]] && fail-attr 'lang' "${URL}" + [[ -z "${REF}" ]] && fail-attr 'ref' "${URL}" + set +e + contains-element "${LANG}" "${LANGS[@]}" + [[ $? != 0 ]] && { + red "Invalid lang '${LANG}' in ${URL}." >&2 + exit 1 + } + set -e + : +} + +echo Linting posts... >&2 +for post in $(jq -r '.posts[] | @base64' "${JSON}"); do + assert-frontmatter "${post}" +done + +echo Linting pages... >&2 +IGNORED_PAGES=(/site.json /sitemap.xml) +for page in $(jq -r '.pages[] | @base64' "${JSON}"); do + URL="$(echo "$page" | base64 --decode | jq -r .url)" + set +e + contains-element "${URL}" "${IGNORED_PAGES[@]}" + if [[ $? != 0 ]]; then + set -e + assert-frontmatter "${page}" + fi + set -e +done + +echo Asserting unique refs... >&2 +KNOWN_IDS=() +for page in $(jq -r '.pages[] | @base64' "${JSON}"); do + URL="$(echo "$page" | base64 --decode | jq -r .url)" + set +e + contains-element "${URL}" "${IGNORED_PAGES[@]}" + if [[ $? != 0 ]]; then + set -e + LANG="$(echo "$page" | base64 --decode | jq -r .lang)" + REF="$(echo "$page" | base64 --decode | jq -r .ref)" + ID="${LANG}:${REF}" + + set +e + contains-element "${ID}" "${KNOWN_IDS[@]}" + [[ $? == 0 ]] && { + red "Duplicated lang:ref match: '${ID}'." >&2 + exit 1 + } + set -e + + KNOWN_IDS+=("${ID}") # printf '%s\n' "${KNOWN_IDS[@]}" + fi + set -e +done + +echo Done. >&2 diff --git a/site.json b/site.json new file mode 100644 index 0000000..0920bf8 --- /dev/null +++ b/site.json @@ -0,0 +1,26 @@ +--- +--- +{ + "posts": [ + {% for post in site.posts %} + { + "title": "{{ post.title | smartify }}", + "url": "{{ post.url }}", + "lang": "{{ post.lang }}", + "ref": "{{ post.ref }}", + "content": {{ post.content | strip_html | jsonify }} + }{% unless forloop.last %},{% endunless %} + {% endfor %} + ], + "pages": [ + {% for page in site.pages %} + { + "title": "{{ page.title | smartify }}", + "url": "{{ page.url }}", + "lang": "{{ page.lang }}", + "ref": "{{ page.ref }}", + "content": {{ page.content | strip_html | jsonify }} + }{% unless forloop.last %},{% endunless %} + {% endfor %} + ] +} diff --git a/sitemap.xml b/sitemap.xml new file mode 100644 index 0000000..1c17a14 --- /dev/null +++ b/sitemap.xml @@ -0,0 +1,29 @@ +--- +--- + + + {% for post in site.posts %} + + {{ site.url }}{{ post.url }} + {% assign versions=site.posts | where:"ref", post.ref %} + {% for version in versions %} + + {% endfor %} + {{ post.date | date_to_xmlschema }} + weekly + + {% endfor %} + + {% for page in site.pages %} + + {{ site.base }}{{ page.url }} + {% if page.ref != nil %} + {% assign versions=site.pages | where:"ref", page.ref %} + {% for version in versions %} + + {% endfor %} + {% endif %} + weekly + + {% endfor %} + -- cgit v1.2.3 From 24ec58d573405c740239b9e96437c5968d037dce Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Wed, 5 Feb 2020 22:17:02 -0300 Subject: DIY jekyll-seo-tag --- Gemfile | 5 ----- Gemfile.lock | 3 --- _config.yml | 3 --- _includes/public-inbox.html | 15 +++++++++++++++ _layouts/default.html | 17 +++++++++++++++-- _layouts/post.html | 16 +--------------- gemset.nix | 11 ----------- 7 files changed, 31 insertions(+), 39 deletions(-) create mode 100644 _includes/public-inbox.html (limited to '_layouts/default.html') diff --git a/Gemfile b/Gemfile index 3ed43f3..0948693 100644 --- a/Gemfile +++ b/Gemfile @@ -1,7 +1,2 @@ source "https://rubygems.org" - gem "jekyll" - -group :jekyll_plugins do - gem "jekyll-seo-tag" # FIXME -end diff --git a/Gemfile.lock b/Gemfile.lock index 65a43b5..58faf53 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -29,8 +29,6 @@ GEM safe_yaml (~> 1.0) jekyll-sass-converter (1.5.2) sass (~> 3.4) - jekyll-seo-tag (2.6.1) - jekyll (>= 3.3, < 5.0) jekyll-watch (2.2.1) listen (~> 3.0) kramdown (1.17.0) @@ -58,7 +56,6 @@ PLATFORMS DEPENDENCIES jekyll - jekyll-seo-tag BUNDLED WITH 1.17.3 diff --git a/_config.yml b/_config.yml index 382eec0..ee3c940 100644 --- a/_config.yml +++ b/_config.yml @@ -6,9 +6,6 @@ author: email: eu@euandre.org markdown: kramdown -plugins: - - jekyll-seo-tag -# FIXME: remove plugins exclude: - Gemfile diff --git a/_includes/public-inbox.html b/_includes/public-inbox.html new file mode 100644 index 0000000..478eac6 --- /dev/null +++ b/_includes/public-inbox.html @@ -0,0 +1,15 @@ +{% if page.lang == 'en' %} + Have a comment on this post? Start a discussion in my + public inbox + by sending an email to + ~euandreh/public-inbox@lists.sr.ht + [mailing list etiquette], + or see existing discussions. +{% elsif page.lang == 'pt' %} + Tem um comentário sobre essa postagem? Comece uma discussão na minha + caixa de entrada pública + mandando um email para + ~euandreh/public-inbox@lists.sr.ht + [etiqueta da lista de email (em inglês)], + ou procure por discussões existentes. +{% endif %} diff --git a/_layouts/default.html b/_layouts/default.html index bd253c8..7240997 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -1,12 +1,25 @@ - + - + + {{ page.title }} + + + + + + + + + {% if page.date %} + + + {% endif %}
diff --git a/_layouts/post.html b/_layouts/post.html index b1b1412..629e02f 100644 --- a/_layouts/post.html +++ b/_layouts/post.html @@ -10,21 +10,7 @@ layout: default

- {% if page.lang == 'en' %} - Have a comment on this post? Start a discussion in my - public inbox - by sending an email to - ~euandreh/public-inbox@lists.sr.ht - [mailing list etiquette], - or see existing discussions. - {% elsif page.lang == 'pt' %} - Tem um comentário sobre essa postagem? Comece uma discussão na minha - caixa de entrada pública - mandando um email para - ~euandreh/public-inbox@lists.sr.ht - [etiqueta da lista de email (em inglês)], - ou procure por discussões existentes. - {% endif %} + {% include public-inbox.html %}

diff --git a/gemset.nix b/gemset.nix index 4c38b33..83eb445 100644 --- a/gemset.nix +++ b/gemset.nix @@ -114,17 +114,6 @@ }; version = "1.5.2"; }; - jekyll-seo-tag = { - dependencies = ["jekyll"]; - groups = ["default"]; - platforms = []; - source = { - remotes = ["https://rubygems.org"]; - sha256 = "1p9fl2r4ni10lbx143zp41caldjs4hg27az5wg42sbwzb7s6z66m"; - type = "gem"; - }; - version = "2.6.1"; - }; jekyll-watch = { dependencies = ["listen"]; groups = ["default"]; -- cgit v1.2.3 From e3d4bd847a04b1797c3f2deb48b50b199ee7ba6c Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Wed, 5 Feb 2020 22:24:48 -0300 Subject: Point to language-specific home --- _config.yml | 3 +++ _layouts/default.html | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) (limited to '_layouts/default.html') diff --git a/_config.yml b/_config.yml index 0692920..b653bb3 100644 --- a/_config.yml +++ b/_config.yml @@ -32,6 +32,9 @@ t: home: en: "EuAndreh's blog" pt: "Blog do EuAndreh" + home_url: + en: '/' + pt: '/pt/' recent_posts: en: 'Recent posts' pt: 'Postagens recentes' diff --git a/_layouts/default.html b/_layouts/default.html index 7240997..c33b960 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -25,7 +25,7 @@