about summary refs log tree commit diff
diff options
context:
space:
mode:
authorHuy-Ngo <duchuy29092000@gmail.com>2021-01-11 21:06:00 +0700
committerHuy-Ngo <duchuy29092000@gmail.com>2021-01-11 21:06:00 +0700
commit828e0c87274811c142535b02465b1ed1783d51d5 (patch)
tree4eab7d3f8ec5b35b8e02044c7dbb376a73dc3378
parentadae8122c4a6dce259bbc09c7c7fc610a1d0cf3d (diff)
downloadblog-828e0c87274811c142535b02465b1ed1783d51d5.tar.gz
Start setting up i18n
-rw-r--r--_config.yml15
-rw-r--r--_layouts/post.html53
-rw-r--r--_posts/2021-01-02-giving-up-on-wordpress.markdown2
-rw-r--r--_posts/2021-01-09-moving-away-from-big-brothers.markdown2
-rw-r--r--_posts/2021-01-11-using-openring-to-add-blogs-you-follow.md2
-rw-r--r--fr/_posts/2021-01-02-giving-up-on-wordpress.markdown74
-rw-r--r--fr/_posts/2021-01-11-using-openring-to-add-blogs-you-follow.md106
7 files changed, 254 insertions, 0 deletions
diff --git a/_config.yml b/_config.yml
index b3e3562..432213d 100644
--- a/_config.yml
+++ b/_config.yml
@@ -70,3 +70,18 @@ exclude:
   - newpost.sh
   - webring.template
   - create-webring.sh
+
+defaults:
+    -
+     scope:
+         path: ""
+     values:
+         lang: en
+         base-url: "/"
+    -
+     scope:
+         path: fr
+     values:
+         lang: fr
+         base-url: "/fr/"
+
diff --git a/_layouts/post.html b/_layouts/post.html
new file mode 100644
index 0000000..4b7e5a6
--- /dev/null
+++ b/_layouts/post.html
@@ -0,0 +1,53 @@
+---
+layout: default
+---
+
+{% assign postsTrans=site.posts | where:"ref", page.ref | sort: 'lang' %}
+
+{% if postsTrans.size == 0 %}
+  {% assign postsTrans=site.pages | where:"ref", page.ref | sort: 'lang' %}
+{% endif %}
+
+<article class="post h-entry" itemscope itemtype="http://schema.org/BlogPosting">
+
+  <header class="post-header">
+    <h1 class="post-title p-name" itemprop="name headline">{{ page.title | escape }}</h1>
+    <p class="post-meta">
+      {%- assign date_format = site.minima.date_format | default: "%b %-d, %Y" -%}
+      <time class="dt-published" datetime="{{ page.date | date_to_xmlschema }}" itemprop="datePublished">
+        {{ page.date | date: date_format }}
+      </time>
+      {%- if page.modified_date -%}
+        ~
+        {%- assign mdate = page.modified_date | date_to_xmlschema -%}
+        <time class="dt-modified" datetime="{{ mdate }}" itemprop="dateModified">
+          {{ mdate | date: date_format }}
+        </time>
+      {%- endif -%}
+      {%- if page.author -%}
+        • {% for author in page.author %}
+          <span itemprop="author" itemscope itemtype="http://schema.org/Person">
+            <span class="p-author h-card" itemprop="name">{{ author }}</span></span>
+            {%- if forloop.last == false %}, {% endif -%}
+        {% endfor %}
+      {%- endif -%}</p>
+  </header>
+
+  <div class="lang">
+    <ul>
+      {% for post in postsTrans %}
+      <li><a class="{{ post.lang }}" href="{{ site.base-url }}{{ post.url }}">{{ post.lang }}</a></li>
+      {% endfor %}
+    </ul>
+  </div>
+
+  <div class="post-content e-content" itemprop="articleBody">
+    {{ content }}
+  </div>
+
+  {%- if site.disqus.shortname -%}
+    {%- include disqus_comments.html -%}
+  {%- endif -%}
+
+  <a class="u-url" href="{{ page.url | relative_url }}" hidden></a>
+</article>
diff --git a/_posts/2021-01-02-giving-up-on-wordpress.markdown b/_posts/2021-01-02-giving-up-on-wordpress.markdown
index c0d69c6..51ed528 100644
--- a/_posts/2021-01-02-giving-up-on-wordpress.markdown
+++ b/_posts/2021-01-02-giving-up-on-wordpress.markdown
@@ -3,6 +3,8 @@ layout: post
 title:  "Giving up on WordPress!"
 date:   2021-01-02 14:44:00 +0700
 tags: blog wordpress writing selfhost
+lang: en
+ref: give-up-wp
 categories: blog update
 ---
 For the last week, I was trying to setting up my own WordPress instance, since I have access to a server and use a free domain name. It was such a hassle. <!--more-->
diff --git a/_posts/2021-01-09-moving-away-from-big-brothers.markdown b/_posts/2021-01-09-moving-away-from-big-brothers.markdown
index a0bfacf..f8d926c 100644
--- a/_posts/2021-01-09-moving-away-from-big-brothers.markdown
+++ b/_posts/2021-01-09-moving-away-from-big-brothers.markdown
@@ -3,6 +3,8 @@ layout: post
 title:  "Moving away from Big Brother(s)"
 date:   2021-01-02 14:44:00 +0700
 tags: software freedom surveillance communication privacy
+lang: en
+ref: big-bros
 categories: freedom privacy
 ---
 
diff --git a/_posts/2021-01-11-using-openring-to-add-blogs-you-follow.md b/_posts/2021-01-11-using-openring-to-add-blogs-you-follow.md
index 0d8e0cf..b3b0710 100644
--- a/_posts/2021-01-11-using-openring-to-add-blogs-you-follow.md
+++ b/_posts/2021-01-11-using-openring-to-add-blogs-you-follow.md
@@ -3,6 +3,8 @@ layout: post
 title:  "Using openring to add blogs you follow"
 date:   2021-01-11 15:51:31 +0700
 tags:   rss blog openring tutorial
+lang: en
+ref: openring-tutor
 categories: blog
 ---
 
diff --git a/fr/_posts/2021-01-02-giving-up-on-wordpress.markdown b/fr/_posts/2021-01-02-giving-up-on-wordpress.markdown
new file mode 100644
index 0000000..0cdc719
--- /dev/null
+++ b/fr/_posts/2021-01-02-giving-up-on-wordpress.markdown
@@ -0,0 +1,74 @@
+---
+layout: post
+title:  "Giving up on WordPress! but in French"
+date:   2021-01-02 14:44:00 +0700
+tags: blog wordpress writing selfhost
+lang: fr
+ref: give-up-wp
+categories: blog update
+---
+For the last week, I was trying to setting up my own WordPress instance, since I have access to a server and use a free domain name. It was such a hassle. <!--more-->
+
+## Why I want to start a blog
+
+Writing is a way of polishing my writing skills. For so long, all what I write has been only code. Now that I'm close to my graduation, writing long text suddenly becomes important to me - I need to write reports and after that my thesis.
+
+It is also a way of expressing myself. Social media is a shorter version for this, and they may attract more interactions from people you know, but blog on the other hand helps you express your idea and opinion publicly. They're also much more organized in the sense that my list of posts does not contain shares from other users, or that I can use hashtags to categorize my posts.
+
+## Choosing WordPress
+
+At first I was thinking of using wordpress.com, since it's already hosted, but then I realized they can put ads on my blogs without my consent (well, technically, they would have my consent if I used their service). On top of that, I always prefer self-hosting whenever possible: I have all control (doubt) over what is running and what not. I would not what a third party to track my readers or showing them ads on my blog.
+
+The server was running on Ubuntu 16.04. That is a rather old one, so it doesn't support latest packages, including Apache, PHP, and WordPress (they do have WordPress in the Ubuntu repo), and I dare not upgrade it.
+
+On the other hand, I already hosted some other services with Nginx there, so I'd prefer to use Nginx instead of Apache. They do have [that option](https://wordpress.org/support/article/nginx/), but alas, those configs file seem long and I was not sure if I would break something while editing the nginx.conf file.
+
+I did try to use Nginx as a reverse proxy to my Apache server, though. It did work, but there is another problem, which I will talk about in a next section
+
+## Using Docker
+
+I also tried another option - docker. I wondered why I didn't think of it earlier.
+
+I have recently been using docker quite regularly, e.g. for CouchDB and RethinkDB which aren't packaged for my distro, or SQLServer and MongoDB, which were required for my database course. Docker is a way to easily run some program in a contained environment with simple configuration that can be input from command line or docker-compose file. Most importantly, they're confirmed to work.
+
+And nice, it did run.
+
+Now I need to set up a domain name for the blog.
+
+## Port forwarding
+
+For personal reason, I'd rather not reveal my domain name here, so I'd use `example.com` in its place.
+
+I signed up a domain name at freenom, and it only took me one day until the domain name is fully available.
+
+The only problem is that `example.com` always show me a bad gateway response. I made sure my Nginx configuration were right, but somehow it weren't listening  on port 80 - the default port for HTTP. I had to go to `example.com:12345` (the port I ran my docker on), and for normal users that doesn't look intuitive at all.
+
+It turned out, I didn't link my configuration correctly, so there are broken symlinks in `/etc/nginx/sites-enabled/` and the configuration was never included.
+
+After I fixed that, it worked nicely.
+
+## Different name == broken website
+
+WordPress uses absolute path (`example.com/blog/something`) rather than relative path (`/blog/something`). This leads to a problem: if I want to migrate to another domain name (guaranteed to happen, since I use a free domain name that will expire eventually). I discovered this when I moved from a port to different port, and from host IP to domain name. It frustrates me, but it isn't a big problem for now.
+
+## Disappointing experience
+
+I did successfully hosted my own WP instance, but it didn't feel right for me.
+
+WordPress is so bloated. They target non-programmer, and they have a lot of drag-and-drop editing. It is hard for me to select the right block and edit it. They have a lot of features for images and widgets that I won't use. Of course I can remove those features, but they would take time and not is worth it.
+
+As a result, I'm refrained from posting there.
+
+## Write.as
+
+Then I was recommended this page on [Mastodon](https://joinmastodon.org/). It feels so right to me: as a programmer I love writing with Markdown - the markup language is so easy to write, and it allows me to write quickly. I can also write it in a preferred text editor such as vim and paste the text here.
+
+I did try to host my own [WriteFreely](https://writefreely.org/) instance (the technology behind write.as), but since I invested too much energy for WordPress I don't feel like it now, even though it seems simple according to the [installation instruction](https://writefreely.org/start). The [docker image](https://hub.docker.com/r/writeas/writefreely) is also not at all documented.
+
+Fortunately, write.as already feels right to me - no ads, and tracking is easily opted out. The only problem here is that my domain name is wasted there.
+
+## Update
+
+Well, I just installed (it was actually easy!), and now I've moved to divers.ml
+
+New update: I just tried jekyll, and it's awesome. Now my blog is hosted on [GitHub](https://huy-ngo.github.io). I guess I will leave the domain unused.
diff --git a/fr/_posts/2021-01-11-using-openring-to-add-blogs-you-follow.md b/fr/_posts/2021-01-11-using-openring-to-add-blogs-you-follow.md
new file mode 100644
index 0000000..19a695a
--- /dev/null
+++ b/fr/_posts/2021-01-11-using-openring-to-add-blogs-you-follow.md
@@ -0,0 +1,106 @@
+---
+layout: post
+title:  "Using openring to add blogs you follow but in French"
+date:   2021-01-11 15:51:31 +0700
+tags:   rss blog openring tutorial
+lang: fr
+ref: openring-tutor
+categories: blog
+---
+
+You may notice that now my blog now has a new section near the footer: a list of articles
+from blogs I follow.  This is generated by [openring], a tool for generating this list.
+
+I found out about this when reading [Drew DeVault's blog][ddvault]
+(who created openring).  I think it is a nice way
+to endorse authors we want to support and share cool things we read to our audience.
+
+In this blog, I will write a tutorial to use this with jekyll.
+
+# Install openring
+
+I am not aware of any prebuilt packages for openring, so let's build it from source.
+
+## Install dependencies
+
+Openring depends on golang.  This works on go1.14, the latest version on Tumbleweed
+repository, but I recommend installing the latest version.
+
+You can refer to [golang]'s installation instruction for details.
+
+## Build from source
+
+Firstly, clone the repository:
+
+```bash
+git clone https://git.sr.ht/~sircmpwn/openring
+```
+
+Next, simply build the packages and link it to `usr/local/bin` so that it can be run:
+
+```bash
+go build -o openring
+sudo cp openring /usr/local/bin/
+```
+
+# Customize looks
+
+From openring's README:
+
+> This is a tool for generating a webring from RSS feeds, so you can link to other blogs you like on your own blog. It's designed to be fairly simple and integrate with any static site generator. The basic usage is:
+> 
+> ```bash
+> openring \
+>   -s https://drewdevault.com/feed.xml \
+>   -s https://emersion.fr/blog/rss.xml \
+>   -s https://danluu.com/atom.xml \
+>   < in.html \
+>   > out.html
+> ```
+
+The `in.html` is a template [whence] openring generate the HTML for the feed.
+
+I copied the template from [DeVault's blog][ring-tmpl] (don't worry, it's MIT-licensed),
+with a little modification:
+
+- I wrap it in a `div.wrapper`. The `wrapper` class is a class in minima theme that limit the max width for readability and auto-collapse on smaller devices.
+- I use `footer-col` for each class. Since this is also styled by minima, I don't have to worry about it.
+- I added a thin border around each article with the following sass (also modified from DeVault's blog)
+
+```scss
+---
+---
+
+.webring {
+  margin-bottom: 1rem;
+  .attribution {
+    float: right;
+    font-size: .8rem;
+    line-height: 3;
+  }
+
+  .footer-col.article {
+    padding: 0.5rem;
+
+    margin: 0 0.5rem;
+    border: 0.01rem solid #333;
+    @media(max-width: 640px) {
+      margin: 0.5rem 0;
+    }   
+  }
+}
+```
+
+# Future works?
+
+Currently, I generate the feed manually when I update my blog.
+This probably is not a really good idea:
+What if I want the webring to be updated even when I'm not active?
+A cronjob would probably solve this problem,
+but I'll left it as an exercise to the reader ;).
+
+[openring]: https://git.sr.ht/~sircmpwn/openring
+[ddvault]: https://drewdevault.com/
+[golang]: https://golang.org/doc/install
+[ring-tmpl]: https://git.sr.ht/~sircmpwn/drewdevault.com/tree/master/item/webring-in.template
+[whence]: /menglish/