commit 86f8e46b1c9f745f2dfb76531344304de0e41e3c
parent fd8508f79444f69b5ed12c35de3fd59186c5298f
Author: oscarbenedito <oscar@obenedito.org>
Date:   Sun,  8 Mar 2020 20:07:27 +0100

Tabs to spaces

Diffstat:
Massets/css/composer.scss | 8++++----
Massets/css/style.scss | 8++++----
Massets/js/composer.js | 8++++----
Mcontent/blog/2019-11-10-deploying-website.md | 10++++------
Mlayouts/_default/list.html | 60++++++++++++++++++++++++++++++------------------------------
5 files changed, 46 insertions(+), 48 deletions(-)

diff --git a/assets/css/composer.scss b/assets/css/composer.scss @@ -12,10 +12,10 @@ --font-family: serif; --nav-height: 3em; - @include lightcolors; - @media (prefers-color-scheme: dark) { - @include darkcolors; - } + @include lightcolors; + @media (prefers-color-scheme: dark) { + @include darkcolors; + } } .dark { @include darkcolors; diff --git a/assets/css/style.scss b/assets/css/style.scss @@ -84,10 +84,10 @@ permission notice: --footer-height: 60px; --radius: 8px; - @include lightcolors; - @media (prefers-color-scheme: dark) { - @include darkcolors; - } + @include lightcolors; + @media (prefers-color-scheme: dark) { + @include darkcolors; + } } .dark { @include darkcolors; diff --git a/assets/js/composer.js b/assets/js/composer.js @@ -32,10 +32,10 @@ function updateWordCount() { $wordcount.textContent = words + " word" + (words != 1 ? "s" : "") + " ยท " + minutes + " minute" + (minutes != 1 ? "s" : ""); } function loadContents() { - var content = localStorage.getItem(key); - if (content != null) { - $composer.value = content; - } + var content = localStorage.getItem(key); + if (content != null) { + $composer.value = content; + } } var updateContents = function() { if ($composer.value == '') { diff --git a/content/blog/2019-11-10-deploying-website.md b/content/blog/2019-11-10-deploying-website.md @@ -11,13 +11,11 @@ Deploying the website would mean copying all the output files from [Hugo](https: The solution I chose was [rsync](https://rsync.samba.org/). It is a great piece of software that efficiently transfers files from one folder to another. It checks the last modification time and the file size to avoid transferring files that are up to date. I already knew this program as I use it to back up my computers to hard drives (it reduces the backup time considerably after the first time), so implementing it should have been a breeze. I encountered two problems: -1. By default, `rsync` makes use of modification times to check whether a file should be transferred, but every time I build my site, all files are created again, so the modification times are always newer than the ones in the server. +1. By default, `rsync` makes use of modification times to check whether a file should be transferred, but every time I build my site, all files are created again, so the modification times are always newer than the ones in the server.\ + There is a quick fix for this: the program has an option (`-c` or `--checksum`) that makes the program use the checksum of a file (instead of the modification time) along with the file size to determine whether it has changed. - There is a quick fix for this: the program has an option (`-c` or `--checksum`) that makes the program use the checksum of a file (instead of the modification time) along with the file size to determine whether it has changed. - -2. `rsync` makes use of auxiliary files while synchronizing them. For some reason (that I still don't know, my guess is something to do with permissions), when those auxiliary files are finally renamed to the definitive filename, it fails, giving out an error and exiting without any file transferred. - - To fix this issue, I used the `--temp-dir` option to specify a local directory as the one that should be used for the temporary files. With that set up, it doesn't give any more errors. +2. `rsync` makes use of auxiliary files while synchronizing them. For some reason (that I still don't know, my guess is something to do with permissions), when those auxiliary files are finally renamed to the definitive filename, it fails, giving out an error and exiting without any file transferred.\ + To fix this issue, I used the `--temp-dir` option to specify a local directory as the one that should be used for the temporary files. With that set up, it doesn't give any more errors. So finally the `rsync` command worked, and the time used to update the website is now around 10 seconds, which is a lot better than a minute (considering my website might get larger, the impact can be even bigger). To automate the process I build a little script that will mount the filesystem, build the site, synchronize it with the server and unmount it again: diff --git a/layouts/_default/list.html b/layouts/_default/list.html @@ -15,36 +15,36 @@ </header> <main class="list"> - {{ $paginator := .Paginator }} - {{ range $paginator.Pages }} - <div class="card h-entry"> - <header> - <h2 class="p-name">{{ .Title }}</h2> - </header> - <section class="content"> - {{ if .Params.subtitle }} - <p class="p-summary">{{ .Params.subtitle }}</p> - {{ else }} - <p class="p-summary">{{ .Plain | htmlUnescape | truncate 200 }}</p> - {{ end }} - </section> - <footer> - {{ with .Params.categories }}<a class="p-category" style="color: var(--secondary-text-color)" href="{{ "blog/categories/" | relURL }}{{ . | urlize }}">{{ . | title }}</a> &middot; {{ end }}<data class="dt-published" datetime="{{ .Date.Format "2006-01-02" }}">{{ .Date.Format "January 2, 2006" }}</data> &middot; {{ partial "read-time.html" . }} - </footer> - <a class="card-link u-url" href="{{ .RelPermalink }}"></a> - </div> - {{ end }} + {{ $paginator := .Paginator }} + {{ range $paginator.Pages }} + <div class="card h-entry"> + <header> + <h2 class="p-name">{{ .Title }}</h2> + </header> + <section class="content"> + {{ if .Params.subtitle }} + <p class="p-summary">{{ .Params.subtitle }}</p> + {{ else }} + <p class="p-summary">{{ .Plain | htmlUnescape | truncate 200 }}</p> + {{ end }} + </section> + <footer> + {{ with .Params.categories }}<a class="p-category" style="color: var(--secondary-text-color)" href="{{ "blog/categories/" | relURL }}{{ . | urlize }}">{{ . | title }}</a> &middot; {{ end }}<data class="dt-published" datetime="{{ .Date.Format "2006-01-02" }}">{{ .Date.Format "January 2, 2006" }}</data> &middot; {{ partial "read-time.html" . }} + </footer> + <a class="card-link u-url" href="{{ .RelPermalink }}"></a> + </div> + {{ end }} - {{ $paginator := .Paginator }} - {{ if or $paginator.HasPrev $paginator.HasNext }} - <div class="pagination"> - {{ if $paginator.HasPrev }} - <a class="button" href="{{ $paginator.Prev.URL }}">&larr; Newer Posts</a> - {{ end }} - {{ if $paginator.HasNext }} - <a class="button right" href="{{ $paginator.Next.URL }}">Older Posts &rarr;</a> - {{ end }} - </div> - {{ end }} + {{ $paginator := .Paginator }} + {{ if or $paginator.HasPrev $paginator.HasNext }} + <div class="pagination"> + {{ if $paginator.HasPrev }} + <a class="button" href="{{ $paginator.Prev.URL }}">&larr; Newer Posts</a> + {{ end }} + {{ if $paginator.HasNext }} + <a class="button right" href="{{ $paginator.Next.URL }}">Older Posts &rarr;</a> + {{ end }} + </div> + {{ end }} </main> {{ end }}