Compare commits

..

3 Commits

Author SHA1 Message Date
532f34c6ab add brachiosaure wu
Signed-off-by: Julien CLEMENT <julien.clement@epita.fr>
2023-05-01 12:28:41 +02:00
9c991511b4 embedded hello friend because i'm lazy
Signed-off-by: Julien CLEMENT <julien.clement@epita.fr>
2023-05-01 07:48:08 +02:00
4af776a3e1 remove submodules
Signed-off-by: Julien CLEMENT <julien.clement@epita.fr>
2023-05-01 07:43:49 +02:00
658 changed files with 34577 additions and 10 deletions

6
.gitmodules vendored

@ -1,6 +0,0 @@
[submodule "jujure/themes/hello_friend"]
path = jujure/themes/hello_friend
url = git@github.com:rhazdon/hugo-theme-hello-friend-ng.git
[submodule "jujure/themes/terminal"]
path = jujure/themes/terminal
url = git@github.com:panr/hugo-theme-terminal.git

@ -0,0 +1,371 @@
---
title: "Inverting a bunch of matrices because reverse engineering or something | Brachiosaure @ FCSC 2023"
date: "2023-04-30 18:00:00"
author: "Juju"
tags: ["Reverse", "Writeup", "fcsc"]
toc: true
---
# Intro
Brachiosaure is a math/puzzle challenge from `\J` for the 2023 edition of the
FCSC. It's difficulty is not in the reversing process, which is fairly trivial
here, but in solving of underlying problem.
## Challenge description
`reverse` | `477 pts` `10 solves` `:star::star:`
```
Vous aimez les QR Codes ? On vous demande d'écrire un générateur d'entrées
valides pour ce binaire, puis de le valider sur le service web fourni où un nom
aléatoire est proposé toutes les 5 secondes.
```
Author: `\J`
## Given files
[brachiosaure](/brachiosaure/brachiosaure)
## Overview
As we can guess from the challenge description, this binary will take images
as input. QR codes images for that matter.
```console
$ file brachiosaure
brachiosaure: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV),
dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1
=3e4d225f1053b2a64de1cd133563e6e655049aca, for GNU/Linux 3.2.0, stripped
$ ldd brachiosaure
linux-vdso.so.1 (0x00007ffd833bd000)
libzbar.so.0 => /usr/lib/libzbar.so.0 (0x00007f3ec2325000)
libpng16.so.16 => /usr/lib/libpng16.so.16 (0x00007f3ec22ec000)
libcrypto.so.1.1 => /usr/lib/libcrypto.so.1.1 (0x00007f3ec1fff000)
libc.so.6 => /usr/lib/libc.so.6 (0x00007f3ec1e18000)
libdbus-1.so.3 => /usr/lib/libdbus-1.so.3 (0x00007f3ec1dc7000)
libv4l2.so.0 => /usr/lib/libv4l2.so.0 (0x00007f3ec1db8000)
libX11.so.6 => /usr/lib/libX11.so.6 (0x00007f3ec1c73000)
libXv.so.1 => /usr/lib/libXv.so.1 (0x00007f3ec1c6b000)
libjpeg.so.8 => /usr/lib/libjpeg.so.8 (0x00007f3ec1be8000)
libz.so.1 => /usr/lib/libz.so.1 (0x00007f3ec1bce000)
libm.so.6 => /usr/lib/libm.so.6 (0x00007f3ec1ae6000)
/lib64/ld-linux-x86-64.so.2 => /usr/lib64/ld-linux-x86-64.so.2 (0x00007f3ec23a2000)
libsystemd.so.0 => /usr/lib/libsystemd.so.0 (0x00007f3ec1a09000)
libv4lconvert.so.0 => /usr/lib/libv4lconvert.so.0 (0x00007f3ec198e000)
libxcb.so.1 => /usr/lib/libxcb.so.1 (0x00007f3ec1963000)
libXext.so.6 => /usr/lib/libXext.so.6 (0x00007f3ec194e000)
libcap.so.2 => /usr/lib/libcap.so.2 (0x00007f3ec1942000)
libgcrypt.so.20 => /usr/lib/libgcrypt.so.20 (0x00007f3ec17fa000)
liblzma.so.5 => /usr/lib/liblzma.so.5 (0x00007f3ec17c7000)
libzstd.so.1 => /usr/lib/libzstd.so.1 (0x00007f3ec16f5000)
liblz4.so.1 => /usr/lib/liblz4.so.1 (0x00007f3ec16d3000)
libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x00007f3ec16b3000)
libXau.so.6 => /usr/lib/libXau.so.6 (0x00007f3ec16ae000)
libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0x00007f3ec16a6000)
libgpg-error.so.0 => /usr/lib/libgpg-error.so.0 (0x00007f3ec1680000)
```
That's a lot of libraries, this is really good news because we can just look up
the documentation of those libraries to understand what is going on.
The most important ones are `libpng` to read the image data and `libzbar` which
is used to read data from a QR code. Turns out symbols are really self
explanatory by themselves, the code basically reads like sources even though it
is stripped.
By executing it, we can already what the program is expecting: a username,
and two png, one for the username and one for the serial, probably QR codes
encoding said username and its serial.
```console
$ ./brachiosaure
Usage: ./brachiosaure <username> <username.png> <serial.png>
```
So is this just a simple keygen that needs to output its key as a QR code ?
(Spoiler it isn't)
## Reversing
### Main
I'm saving you the trouble of renaming the variables, the function I called
`get_qr_data` reads like a charm. It basically is just a succession of calls to
`libpng` and `libzbar`, it does exactly what you think it does, reads an image
file, decode the QR code it contains and outputs everything in the pointers
passed as parameters so I won't show the process of reversing it.
The only thing worth pointing is that it grayscales the input image.
{{< code file="/static/brachiosaure/main.c" language="c" >}}
So we compute the `sha512` of the username, this gives us a digest, that we will
keep for later, just remember that we have this digest of the username.
We then decode the 2 QR codes, both seem to need to encode `0x40` bytes of data.
(I know you already guessed it, a sha512 is also 0x40 bytes long).
And finally we perform some checks:
- Both pictures needs to be a square of the same size
- The encoded data of the user QR code needs to be equal to the user digest
- The serial check, taking both QR datas as input
- And finally a last check but this time taking both images data instead of the QR data.
### check_serial
{{< code file="/static/brachiosaure/check_serial.c" language="c" >}}
Hmmm we find again the same interesting check that was performed in the main
function, something is already interesting but let's first note things that
we can already guess from this:
Since it take our images as input in main and image width, it certainly
interprets the data as a linearized 2 dimensionnal array, taking the width as
parameter. We can confirm this since the check serial is called with size `0x8`
as parameter and `0x8 * 0x8 == 0x40`.
Now let's see what is different:
```c
// Inside check serial
something_interesting(user_digest, user_digest, &buff, size);
res = memcmp(serial, buff, size * size) == 0;
// Inside main
int32_t win = something_interesting(username_img_data, serial_img_data,
&an_interesting_output, user_width);
```
First the result is not used in the same way:
- Inside `check_serial`, the return value is discarded, and the output buffer is
compared to the serial, so it is bascically a keygen, seems easy enough
- Inside `main`, the output buffer is discarded and only the return value is
checked
Then in the `main`, the function is called with the user and serial images data,
but in check_serial, it is called with the digest data twice.
OK let's see what this does, we need to understand what doest it put in the
output buffer since it will be the serial we will need to encode in the second
QR code of the input, but we also need to understand the return value.
### dot_product
Cutting drama right now, it is simply a matrix dot product:
{{< code file="/static/brachiosaure/dot_product.c" language="c" >}}
Alright so to recap what actually happens:
- In check serial, we perform the dot product of the user digest, interpreted a
linearized 8 * 8 matrix, with itself, effectively squaring it, which gives us
our serial (also in a linearized 8 * 8 matrix).
- In main, we perform the dot product of the user and serial IMAGES, and we can
see from the code that the return value indicates wether or not the resulting
dot product is the identity matrix.
So yeah, congratulation, it is the end of the reversing part.
We now need to, given a random username:
- Compute its digest
- Square it to get the serial
- Output both the digest and the serial to a QR code each
- (The fun part) Make sure that the images of said QR codes are invertible
## Splitting the problem
So at first I though this was impossible, but I gradually had more and more
tricks up my sleeve to solve this, which I finally almost all threw by the
window when I discovered how easy the solver actually is.
I still think that even though completely over engineered and full of dead ends,
my though process may be of value for someone I guess.
### Recontextualizing
So first we need to understand that we are not doing any kind of dot product and
are not working with any kind of matrices.
Both only operate over the unsigned integers modulo 256, since the dot product
stores its output on a `char`. This will be the key to make the matrix
invertible.
You can then notice that in the fieds of integers modulo 256, `0xff * 0xff ==
1`. When I noticed I started to think that I could carefully place white pixels
on the QR code to specifically put some 1s where I wanted, but since patching a
single byte of the first/second matrix will impact the entire corresponding
row/column of the dot product, it doesn't work obviously
Now, obviously we will need to patch the QR code image, the question is how much
so that `libzbar` still decodes the correct digests and serial. So obviously,
we may resize the images of the QR codes to add some data.
### Dead end
So then this is where I had a really dumb idea. I though that maybe I could
append carefully crafted columns and empty lines to the first matrix, and
carefully crafted line and empty columns to the second matrix so that the result
of the dot product int overflow back to 0 or 1. Thus outputing 2 new images with the QR code in the top left corner.
And it actually kind of worked, but not entirely so I won't detail the
algorithm, I still implemented it entirely because I was really convincend this
was the intended way.
Why it doesn't work is because yes by adding rows and columns like that, being
carefull that everything cancels nicely with the data you inject on the other
matrix, the first N rows and columns of the original images have indeed been
inverted, but now you have a matrix which is somewhat bigger, and the parts you
added are not inverted, it was entirely 0 if I did not put the diagonal to 1 to
the rows/columns I added. If I decided to put the diagonal, then the bytes you
carefully injected are then reflected allong the dot product in this new bigger
matrix. So either way you need to perform the same process to repatch everyting
over this bigger matrix, infinetely recursing.
### How it's actually done
OK, so after this misadventure, the next step is to understand that a single
element of coordinates (i, j) from the dot product is impacted by all elements
of the ith line of the first matrix and all elements of the jth line. (You
actually already needed to understand this to implement my dumb idea but now we
will make it interesting).
Let's say that I take my first QR code and I double it's size and width like
this where the purple ones are all 0 matrices and the green one is the identity:
{{< image src="/brachiosaure/resizing.png" style="border-radius: 8px;" >}}
You can clearly see that if you patch any bytes in the identity matrix in the bottom right you will never impact the result of the top left corner of the dot
product.
If you are not convinced: take this more striking example:
{{< image src="/brachiosaure/dissociate.png" style="border-radius: 8px;" >}}
See how you can perform the dot product on each of the corner independently ?
That is the key to solving this, because now instead of putting the identity
matrix in the corresponding corner in the other image, we can simple compute the
inverse of the QR code:
{{< image src="/brachiosaure/overlap_inverses.png" style="border-radius: 8px;" >}}
## Inverting the two matrices
You may think "Ok this is over GG NO RE", but it is not that simple, at least it
wasn't for me because I suck at maths.
So I tried multiple implementations of the matrix modular inversion, some
worked, some didn't, but most importantly, all of them took ages to run on
actual images, about 10 minutes for most, and we are limited to 5 seconds on the
remote service.
The best implementation was the `sagemath` one which computed real size images
inverses in about 20 seconds, still too slow. But at least I could test locally
that the generated images were accepted by the program, and they were, so I knew
I was on the right track.
I tried reducing the size of the QR code to make it faster, and it ran in less
than a second, but the program could not recognize the data in the QR code
anymore.
Well we need another strategy. First because it is taking too long, but also
because not every matrix turns out to be invertible at all. And I don't want to
bruteforce the remote service to be lucky to have a username AND a serial matrix
that are both invertible and then be lucky enough that the program successfully
decodes the QR code.
## If it isn't invertible, juste make it invertible duh
So I go for a cleaner approach. I am not guaranteed that the QR code is invertible, fine, patch it to make it invertible.
And there is a really interesting property indeed:
{{< image src="/brachiosaure/invertible.png" style="border-radius: 8px;" >}}
By adding empty matrices and an identity matrix in the bottom right corner, the
resulting matrix is always invertible, and the inverse can be trivially computed
since it is simply moving matrices arround and negating the original image modulo 256 `notice the "-(QRuser)" in the inverted matrix`.
## Putting everything together
So what we need to do given a random username:
- Compute its sha512 digest
- Compute the serial, the square of the matrix of the digest
- Generate a QR code for the digest and another one for the serial
- Make both QR code invertible by adding empty and identity matrices as shown above
- Compute the said inverse of said matrices
- In the result user.png put:
- The invertible digest QR code in the top left corner
- The inverted serial QR code in the bottom right corner
- In the result serial.png put:
- The inverted digest QR code in the top left corner
- The invertible serial QR code in the bottom right corner
{{< image src="/brachiosaure/final.png" style="border-radius: 8px;" >}}
## Solver
Here is the final solver script, which also automates fetching the username
from the remote service and the upload of the images to recover the flag.
But before leaving this writeup there is still something I want to show you at the end.
{{< code file="/static/brachiosaure/solve_writeup.py" language="c" >}}
```console
$ ./solve_writeup.py
<strong>FCSC{c2ddbd0310bcf5f65c576453ee9697774afd38dc887b64f4dccc63ac598d084b}</strong>
```
## Side notes
Here are examples of images generated by this solver for username `90QOCSdkzFE3rrYD2GdkrZkh4q`:
The original user digest QR code:
{{< image src="/brachiosaure/user.png" style="border-radius: 8px;" >}}
The original serial QR code:
{{< image src="/brachiosaure/serial.png" style="border-radius: 8px;" >}}
The patched user png
{{< image src="/brachiosaure/90QOCSdkzFE3rrYD2GdkrZkh4q_usr.png" style="border-radius: 8px;" >}}
The patched serial png
{{< image src="/brachiosaure/90QOCSdkzFE3rrYD2GdkrZkh4q_serial.png" style="border-radius: 8px;" >}}
As you can notice, there isn't any noise visible by naked eye, this script therefore get the flag 100% of the time.
Why is it so clean ? Simply because of the strategy we used to compute the
inverse matrix:
- We add empty matrices: they are black so no noise
- We add identity matrices: they only have the diagonal set to 1 so only a little bit grayer than the black, no noise visible by naked eyes
- We add the opposite of the matrix, and this is the clean part: our original matrices only hold black and white pixels so respectively `0x0` and `0xff`, so the opposite of `0` is still `0` and the opposite of `0xff` if `1` modulo 256, so like the identity matrix, they are nearly invisible. If you look closely though :eyes: you will see that all white pixels of the QR code were indeed reflected as very faint taint of gray in its inverse matrix on the other image.

@ -1 +1 @@
{"Target":"main.4e5c639214707eff609bb55fe49e183dee42258a73bc90e4cc7b0a84f900798a.css","MediaType":"text/css","Data":{"Integrity":"sha256-TlxjkhRwfv9gm7Vf5J4YPe5CJYpzvJDkzHsKhPkAeYo="}} {"Target":"main.b78c3be9451dc4ca61ca377f3dc2cf2e6345a44c2bae46216a322ef366daa399.css","MediaType":"text/css","Data":{"Integrity":"sha256-t4w76UUdxMphyjd/PcLPLmNFpEwrrkYhajIu82bao5k="}}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

@ -0,0 +1,14 @@
uint64_t check_serial(void* user_digest, int64_t serial, int32_t size)
{
void* buff = NULL;
int64_t res;
if (user_digest == NULL || serial == NULL)
return 0;
something_interesting(user_digest, user_digest, &buff, size);
res = memcmp(serial, buff, size * size) == 0;
free(buff);
return res;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

@ -0,0 +1,49 @@
uint64_t dot_product(char* A, char* B, char** out, int32_t size)
{
if (A == NULL || B == NULL)
{
return 0;
}
int32_t res = 1;
int64_t i = 0;
int32_t j = 0;
*out = calloc(size * size, 1);
while (size > j)
{
int64_t k = 0;
char* A_line = A + i;
do
{
char* B_col = B + k;
int64_t col = 0;
int32_t sum = 0;
do
{
char element;
element = A_line[col];
element *= B_col[0];
col += 1;
B_col += size;
sum += element;
} while (size > col);
((*out) + i)[k] = sum; // ith line, kth column
bool win;
if (j != k) // Check if on the diagonal
win = sum == 0; // if not check that it is 0
else
win = sum == 1; // if yes check it is 1
k += 1;
res &= win; // Bitwise and, every number must be correct
} while (size > k);
j += 1;
i += size;
}
return res;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

@ -0,0 +1,71 @@
int32_t main(int32_t argc, char** argv, char** envp) __noreturn
{
int32_t user_status;
int32_t serial_status;
int32_t status;
if (argc == 4)
{
int32_t user_width = 0;
int32_t user_height = 0;
void* username_img_data = NULL;
void* user_zbar_img = NULL;
int32_t serial_width = 0;
int32_t serial_height = 0;
void* serial_img_data = NULL;
void* serial_zbar_img = NULL;
char digest[0x40];
strcpy(&digest, argv[1]);
void sha512;
SHA512_Init(&sha512);
SHA512_Update(&sha512, &digest, strlen(argv[1]));
SHA512_Final(&digest, &sha512);
char qr_data_user[0x40];
user_status = get_qr_data(argv[2],
&username_img_data,
&user_width,
&user_height,
&user_zbar_img,
&qr_data_user,
0x40);
char qr_data_serial[0x40];
serial_status = get_qr_data(argv[3],
&serial_img_data,
&serial_width,
&serial_height,
&serial_zbar_img,
&qr_data_serial,
0x40);
if ((user_status != 0 && serial_status != 0))
{
char err = (serial_width != user_width)
| (serial_height != user_height)
| (user_width != user_height)
| (memcmp(&digest, &qr_data_user, 0x40) != 0)
| (check_serial(&qr_data_user, &qr_data_serial, 8) == 0);
void* an_interesting_output = NULL;
int32_t win = something_interesting(username_img_data, serial_img_data, &an_interesting_output, user_width);
free(username_img_data);
free(serial_img_data);
free(an_interesting_output);
status = ((uint32_t)(err | ((int8_t)win == 0)));
}
}
else
{
printf("Usage: %s <username> <username.p…", *(int64_t*)argv);
}
if (((argc != 4 || (argc == 4 && user_status == 0)) || ((argc == 4 && user_status != 0) && serial_status == 0)))
{
status = 1;
}
exit(status);
/* no return */
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 438 B

@ -0,0 +1,192 @@
#!/usr/bin/env python3
import hashlib
import qrcode
from PIL import Image
import numpy as np
import requests
def get_user():
r = requests.get("https://brachiosaure.france-cybersecurity-challenge.fr/")
name = r.text.split("text-warning\">")[1].split('<')[0]
return name
def get_digest(name):
m = hashlib.sha512()
m.update(name.encode())
digest = m.digest()
return digest
def linearize_serial(matrix_serial):
serial = bytearray()
for line in matrix_serial:
for b in line:
serial.append(b % 256)
return bytes(serial)
def img_to_matrix(img):
array = list(img.getdata())
width, height = img.size
matrix_img = [[array[i * width + j] for j in range(width)] for i in range(height)]
return matrix_img
def matrix_to_img(mat, path):
array = np.uint8(mat)
img = Image.fromarray(array)
img.save(path)
def gen_qrcode(data, path):
qr = qrcode.QRCode(version = 1, box_size = 2, border = 2)
qr.add_data(data)
qr.make()
qr_usr = qr.make_image()
qr_usr.save(path)
def identitymatrix(n):
return [[int(x == y) for x in range(0, n)] for y in range(0, n)]
def get_flag(name):
files = {
"upload1": open(f"{name}_usr.png", "rb"),
"upload2": open(f"{name}_serial.png", "rb")
}
r = requests.post("https://brachiosaure.france-cybersecurity-challenge.fr/login", files=files)
for line in r.text.split('\n'):
if "FCSC{" in line:
print(line)
name = get_user()
digest = get_digest(name)
matrix_usr = [[digest[i * 8 + j] for j in range(8)] for i in range(8)]
matrix_usr = np.array(matrix_usr)
matrix_serial = np.dot(matrix_usr, matrix_usr)
serial = linearize_serial(matrix_serial)
gen_qrcode(digest, "user.png")
gen_qrcode(serial, "serial.png")
img_usr = Image.open("./user.png", "r")
img_serial = Image.open("./serial.png", "r")
matrix_img_usr = img_to_matrix(img_usr)
matrix_img_serial = img_to_matrix(img_serial)
def invert(usr, serial):
# Add empty and identity matrices to maka it invetible
usr = make_invertible(usr)
serial = make_invertible(serial)
n = len(usr)
# Total size after redimensionning
new_n = n * 2
# The magic inversion by swapping corners and computing matrix opposite
usr_inv = invert_magic(usr)
serial_inv = invert_magic(serial)
# Will hold the final user png
new_usr = []
# Will hold the final serial png
new_serial = []
# Create the new_usr
for i in range(new_n):
line = [0] * new_n
if i < n:
for j in range(n):
line[j] = usr[i][j]
if i >= n:
for j in range(n):
line[j + n] = int(serial_inv[i - n][j])
new_usr.append(line)
# Create the new_serial
for i in range(new_n):
line = [0] * new_n
if i < n:
for j in range(n):
line[j] = int(usr_inv[i][j])
if i >= n:
for j in range(n):
line[j + n] = serial[i - n][j]
new_serial.append(line)
return new_usr, new_serial
def make_invertible(mat):
res = []
n = len(mat)
ident = identitymatrix(n)
# Add the identity matrix below the original
for line in ident:
mat.append(line)
for i in range(len(mat)):
line = mat[i]
for j in range(n):
# Add the identity matrix at the right of the original
if i < n:
line.append(ident[i][j])
# Add the empty matrix at the bottom right corner
else:
line.append(0)
return mat
def invert_magic(mat):
n_tot = len(mat)
n = n_tot // 2
#Create a new empty matrix to hold the result
res = [[0 for _ in range(n)] for _ in range(n)]
ident = identitymatrix(n)
# Add the identity matrix below
for line in ident:
res.append(line)
for i in range(len(mat)):
line = res[i]
for j in range(n):
# Identity matrix on the right
if i < n:
line.append(ident[i][j])
# Oposite of the original in the bottom right corner
else:
el = -mat[i - n][j] % 256
line.append(el)
return res
res_usr, res_serial = invert(matrix_img_usr, matrix_img_serial)
matrix_to_img(res_usr, f"{name}_usr.png")
matrix_to_img(res_serial, f"{name}_serial.png")
get_flag(name)

Binary file not shown.

After

Width:  |  Height:  |  Size: 451 B

@ -1 +0,0 @@
Subproject commit fff3cc7bcd46476834e5a975e13dce0766c813bd

@ -0,0 +1,60 @@
---
env:
es6: true
extends:
# https://github.com/airbnb/javascript
- airbnb
- eslint:recommended
- prettier
parser: babel-eslint
rules:
# best practices
arrow-parens:
- 2
- as-needed
semi:
- 2
- never
class-methods-use-this: 0
comma-dangle:
- 2
- always-multiline
no-console:
- 2
no-unused-expressions: 0
no-param-reassign:
- 2
- props: false
no-useless-escape: 0
func-names: 0
quotes:
- 2
- single
- allowTemplateLiterals: true
no-underscore-dangle: 0
object-curly-newline: 0
function-paren-newline: 0
operator-linebreak:
- 2
- after
no-unused-vars:
- 2
- argsIgnorePattern: "^_"
# jsx a11y
jsx-a11y/no-static-element-interactions: 0
jsx-a11y/anchor-is-valid:
- 2
- specialLink:
- to
globals:
document: true
requestAnimationFrame: true
window: true
self: true
fetch: true
Headers: true

38
jujure/themes/hello_friend/.gitignore vendored Normal file

@ -0,0 +1,38 @@
# Created by https://www.gitignore.io/api/macos
# Edit at https://www.gitignore.io/?templates=macos
### macOS ###
# General
.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
# End of https://www.gitignore.io/api/macos
.vscode
# customize Headers whiteout touch git submodule.
layouts/partials/extra-head.html

@ -0,0 +1,14 @@
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## 2020-05-13
### Added
- Changelog
### Changed
- In order to make the image handling more consistent, the `cover` tag does not force the image to live in `/img/` anymore. [!131](https://github.com/rhazdon/hugo-theme-hello-friend-ng/pull/131).

@ -0,0 +1,4 @@
# How to contribute
If you spot any bugs, please use [Issue Tracker](https://github.com/rhazdon/hugo-theme-hello-friend-ng/issues) or if you want to add a new feature directly please create a new [Pull Request](https://github.com/rhazdon/hugo-theme-hello-friend-ng/pulls).

@ -0,0 +1,11 @@
The MIT License (MIT)
Original work Copyright (c) 2018 Track3<br />
Original work Copyright (c) 2019 panr<br />
Modified work Copyright (c) 2019 Djordje Atlialp<br />
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

@ -0,0 +1,210 @@
# Hello Friend NG
![Hello Friend NG](https://dsh.re/d914c)
## General informations
This theme was highly inspired by the [hello-friend](https://github.com/panr/hugo-theme-hello-friend) and [hermit](https://github.com/Track3/hermit). A lot of kudos for their great work.
---
## Table of Contents
- [Features](#features)
- [How to start](#how-to-start)
- [How to configure](#how-to-configure)
- [More](#more-things)
- [Built in shortcodes](#built-in-shortcodes)
- [image](#image)
- [Code highlighting](#code-highlighting)
- [Favicon](#favicon)
- [Audio Support](#audio-support)
- [Social Icons](#social-icons)
- [Known issues](#known-issues)
- [How to edit the theme](#how-to-edit-the-theme)
- [Changelog](CHANGELOG.md)
- [Sponsoring](#sponsoring)
- [Licence](#licence)
---
## Features
- Theming: **dark/light mode**, depending on your system preferences or the users choice
- Great reading experience thanks to [**Inter font**](https://rsms.me/inter/), made by [Rasmus Andersson](https://rsms.me/about/)
- Nice code highlighting thanks to [**PrismJS**](https://prismjs.com)
- An easy way to modify the theme with Hugo tooling
- Fully responsive
- Support for audio in posts (thanks to [@talbotp](https://github.com/talbotp))
- Builtin (enableable/disableable) multilanguage menu
- Support for social icons
- Support for sharing buttons
- Support for [Commento](https://commento.io)
- Support for [Plausible](https://plausible.io) (thanks to [@Joffcom](https://github.com/Joffcom))
## How to start
You can download the theme manually by going to [https://github.com/rhazdon/hugo-theme-hello-friend-ng.git](https://github.com/rhazdon/hugo-theme-hello-friend-ng.git) and pasting it to `themes/hello-friend-ng` in your root directory.
You can also clone it directly to your Hugo folder:
``` bash
$ git clone https://github.com/rhazdon/hugo-theme-hello-friend-ng.git themes/hello-friend-ng
```
If you don't want to make any radical changes, it's the best option, because you can get new updates when they are available. To do so, include it as a git submodule:
``` bash
$ git submodule add https://github.com/rhazdon/hugo-theme-hello-friend-ng.git themes/hello-friend-ng
```
## How to configure
The theme doesn't require any advanced configuration. Just copy the following config file.
To see all possible configurations, [check the docs](docs/config.md).
Note: There are more options to configure. Take a look into the `config.toml` in `exampleSite`.
``` toml
baseurl = "localhost"
title = "My Blog"
languageCode = "en-us"
theme = "hello-friend-ng"
paginate = 10
[params]
dateform = "Jan 2, 2006"
dateformShort = "Jan 2"
dateformNum = "2006-01-02"
dateformNumTime = "2006-01-02 15:04"
# Subtitle for home
homeSubtitle = "A simple and beautiful blog"
# Set disableReadOtherPosts to true in order to hide the links to other posts.
disableReadOtherPosts = false
# Enable sharing buttons, if you like
enableSharingButtons = true
# Show a global language switcher in the navigation bar
enableGlobalLanguageMenu = true
# Metadata mostly used in document's head
description = "My new homepage or blog"
keywords = "homepage, blog"
images = [""]
[taxonomies]
category = "blog"
tag = "tags"
series = "series"
[languages]
[languages.en]
title = "Hello Friend NG"
subtitle = "A simple theme for Hugo"
keywords = ""
copyright = '<a href="https://creativecommons.org/licenses/by-nc/4.0/" target="_blank" rel="noopener">CC BY-NC 4.0</a>'
readOtherPosts = "Read other posts"
[languages.en.params.logo]
logoText = "hello friend ng"
logoHomeLink = "/"
# or
#
# path = "/img/your-example-logo.svg"
# alt = "Your example logo alt text"
# And you can even create generic menu
[[menu.main]]
identifier = "blog"
name = "Blog"
url = "/posts"
```
## More things
### Built-in shortcodes
Of course you are able to use all default shortcodes from hugo (https://gohugo.io/content-management/shortcodes/).
#### image
Properties:
- `src` (required)
- `alt` (optional)
- `position` (optional, default: `left`, options: [`left`, `center`, `right`])
- `style`
Example:
``` golang
{{< image src="/img/hello.png" alt="Hello Friend" position="center" style="border-radius: 8px;" >}}
```
### Code highlighting
By default the theme is using PrismJS to color your code syntax. All you need to do is to wrap you code like this:
<pre>
``` html
// your code here
```
</pre>
### Favicon
Check the [docs](docs/favicons.md).
### Audio Support
You wrote an article and recorded it? Or do you have a special music that you would like to put on a certain article? Then you can do this now without further ado.
In your article add to your front matters part:
```yaml
audio: path/to/file.mp3
```
## Social Icons:
A large variety of social icons are available and can be configured like this:
```toml
[[params.social]]
name = "<site>"
url = "<profile_URL>"
```
Take a look into this [list](docs/svgs.md) of available icon options.
If you need another one, just open an issue or create a pull request with your wished icon. :)
## Known issues
There is a bug in Hugo that sometimes causes the main page not to render correctly. The reason is an empty taxonomy part.
Related issue tickets: [!14](https://github.com/rhazdon/hugo-theme-hello-friend-ng/issues/14) [!59](https://github.com/rhazdon/hugo-theme-hello-friend-ng/issues/59).
Either you comment it out completely or you write the following in
``` toml
[taxonomies]
tag = "tags"
category = "categories"
```
## How to edit the theme
Just edit it. You don't need any node stuff. ;)
## Sponsoring
If you like my work and if you think this project is worth to support it, just <br />
<a href="https://www.buymeacoffee.com/djordjeatlialp" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/default-green.png" alt="Buy Me A Coffee" style="height: 51px !important;width: 217px !important;" ></a>
## Licence
Copyright © 2019-2021 Djordje Atlialp
The theme is released under the MIT License. Check the [original theme license](https://github.com/rhazdon/hugo-theme-hello-friend-ng/blob/master/LICENSE.md) for additional licensing information.

@ -0,0 +1,8 @@
---
title: "{{ replace .Name "-" " " | title }}"
date: {{ .Date }}
draft: true
comments: false
images:
---

@ -0,0 +1,10 @@
---
title: "{{ replace .Name "-" " " | title }}"
date: {{ .Date }}
draft: true
toc: false
images:
tags:
- untagged
---

@ -0,0 +1,57 @@
/**
* Theming.
*
* Supports the preferred color scheme of the operation system as well as
* the theme choice of the user.
*
*/
const themeToggle = document.querySelector(".theme-toggle");
const chosenTheme = window.localStorage && window.localStorage.getItem("theme");
const chosenThemeIsDark = chosenTheme == "dark";
const chosenThemeIsLight = chosenTheme == "light";
// Detect the color scheme the operating system prefers.
function detectOSColorTheme() {
if (chosenThemeIsDark) {
document.documentElement.setAttribute("data-theme", "dark");
} else if (chosenThemeIsLight) {
document.documentElement.setAttribute("data-theme", "light");
} else if (window.matchMedia("(prefers-color-scheme: dark)").matches) {
document.documentElement.setAttribute("data-theme", "dark");
} else {
document.documentElement.setAttribute("data-theme", "light");
}
}
// Switch the theme.
function switchTheme(e) {
if (chosenThemeIsDark) {
localStorage.setItem("theme", "light");
} else if (chosenThemeIsLight) {
localStorage.setItem("theme", "dark");
} else {
if (document.documentElement.getAttribute("data-theme") == "dark") {
localStorage.setItem("theme", "light");
} else {
localStorage.setItem("theme", "dark");
}
}
detectOSColorTheme();
window.location.reload();
}
// Event listener
if (themeToggle) {
themeToggle.addEventListener("click", switchTheme, false);
window
.matchMedia("(prefers-color-scheme: dark)")
.addEventListener("change", (e) => e.matches && detectOSColorTheme());
window
.matchMedia("(prefers-color-scheme: light)")
.addEventListener("change", (e) => e.matches && detectOSColorTheme());
detectOSColorTheme();
} else {
localStorage.removeItem("theme");
}

@ -0,0 +1,32 @@
// Mobile menu
const menuTrigger = document.querySelector(".menu-trigger");
const menu = document.querySelector(".menu");
const mobileQuery = getComputedStyle(document.body).getPropertyValue(
"--phoneWidth"
);
const isMobile = () => window.matchMedia(mobileQuery).matches;
const isMobileMenu = () => {
menuTrigger && menuTrigger.classList.toggle("hidden", !isMobile());
menu && menu.classList.toggle("hidden", isMobile());
};
isMobileMenu();
menuTrigger &&
menuTrigger.addEventListener(
"click",
() => menu && menu.classList.toggle("hidden")
);
window.addEventListener("resize", isMobileMenu);
const language = document.getElementsByTagName('html')[0].lang;
const logo = document.querySelector(".logo__pathname");
if(logo){
window.onload = () => {
let path = window.location.pathname.substring(1);
path = path.replace(language+'/','')
logo.textContent += path.substring(0,path.indexOf('/'));
};
}

File diff suppressed because one or more lines are too long

@ -0,0 +1,9 @@
.btn-404 svg {
vertical-align: middle;
display: inline-block;
margin-right: 5px;
}
.btn-404 a {
margin: 0 10px;
}

@ -0,0 +1,139 @@
.button-container {
display: table;
margin-left: auto;
margin-right: auto;
}
button,
.button,
a.button {
position: relative;
display: flex;
align-items: center;
justify-content: center;
padding: 8px 18px;
margin-bottom: 5px;
text-decoration: none;
text-align: center;
font-weight: 500;
border-radius: 8px;
border: 1px solid transparent;
appearance: none;
cursor: pointer;
outline: none;
// Default
background: $light-background-header;
@media (prefers-color-scheme: dark) {
background: $dark-background-header;
color: inherit;
}
@media (prefers-color-scheme: light) {
background: $light-background-header;
}
[data-theme=dark] & {
background: $dark-background-header;
color: inherit;
}
[data-theme=light] & {
background: $light-background-header;
}
&.outline {
background: transparent;
box-shadow: none;
padding: 8px 18px;
// Default
border-color: $light-background-secondary;
@media (prefers-color-scheme: dark) {
border-color: $dark-background-secondary;
color: inherit;
}
@media (prefers-color-scheme: light) {
border-color: $light-background-secondary;
}
[data-theme=dark] & {
border-color: $dark-background-secondary;
color: inherit;
}
[data-theme=light] & {
border-color: $light-background-secondary;
}
:hover {
transform: none;
box-shadow: none;
}
}
&.primary {
box-shadow: 0 4px 6px rgba(50, 50, 93, .11), 0 1px 3px rgba(0, 0, 0, .08);
&:hover {
box-shadow: 0 2px 6px rgba(50, 50, 93, .21), 0 1px 3px rgba(0, 0, 0, .08);
}
}
&.link {
background: none;
font-size: 1rem;
}
&.small {
font-size: .8rem;
}
&.wide {
min-width: 200px;
padding: 14px 24px;
}
}
.code-toolbar {
margin-bottom: 20px;
.toolbar-item a {
position: relative;
display: inline-flex;
align-items: center;
justify-content: center;
padding: 3px 8px;
margin-bottom: 5px;
text-decoration: none;
text-align: center;
font-size: 13px;
font-weight: 500;
border-radius: 8px;
border: 1px solid transparent;
appearance: none;
cursor: pointer;
outline: none;
// Default
background: $light-background-secondary;
@media (prefers-color-scheme: dark) {
background: $dark-background-secondary;
color: inherit;
}
@media (prefers-color-scheme: light) {
background: $light-background-secondary;
}
[data-theme=dark] & {
background: $dark-background-secondary;
color: inherit;
}
[data-theme=light] & {
background: $light-background-secondary;
}
}
}

File diff suppressed because it is too large Load Diff

@ -0,0 +1,50 @@
@font-face {
font-family: 'Inter';
font-style: normal;
font-display: auto;
font-weight: 400;
src: url("../fonts/Inter-Regular.woff2") format("woff2"),
url("../fonts/Inter-Regular.woff") format("woff");
}
@font-face {
font-family: 'Inter';
font-style: italic;
font-display: auto;
font-weight: 400;
src: url("../fonts/Inter-Italic.woff2") format("woff2"),
url("../fonts/Inter-Italic.woff") format("woff");
}
@font-face {
font-family: 'Inter';
font-style: normal;
font-display: auto;
font-weight: 600;
src: url("../fonts/Inter-Medium.woff2") format("woff2"),
url("../fonts/Inter-Medium.woff") format("woff");
}
@font-face {
font-family: 'Inter';
font-style: italic;
font-display: auto;
font-weight: 600;
src: url("../fonts/Inter-MediumItalic.woff2") format("woff2"),
url("../fonts/Inter-MediumItalic.woff") format("woff");
}
@font-face {
font-family: 'Inter';
font-style: normal;
font-display: auto;
font-weight: 800;
src: url("../fonts/Inter-Bold.woff2") format("woff2"),
url("../fonts/Inter-Bold.woff") format("woff");
}
@font-face {
font-family: 'Inter';
font-style: italic;
font-display: auto;
font-weight: 800;
src: url("../fonts/Inter-BoldItalic.woff2") format("woff2"),
url("../fonts/Inter-BoldItalic.woff") format("woff");
}

@ -0,0 +1,49 @@
.footer {
padding: 40px 20px;
flex-grow: 0;
color: $light-color-secondary;
&__inner {
display: flex;
align-items: center;
justify-content: center;
margin: 0 auto;
width: 760px;
max-width: 100%;
@media #{$media-size-tablet} {
flex-direction: column;
}
}
&__content {
display: flex;
flex-direction: row;
align-items: center;
font-size: 1rem;
color: $light-color-secondary;
@media #{$media-size-tablet} {
flex-direction: column;
margin-top: 10px;
}
& > *:not(:last-child)::after {
content: "";
padding: 0 5px;
@media #{$media-size-tablet} {
content: "";
padding: 0;
}
}
& > *:last-child {
padding: 0 0px;
@media #{$media-size-tablet} {
padding: 0;
}
}
}
}

@ -0,0 +1,63 @@
.header {
display: flex;
align-items: center;
justify-content: center;
position: relative;
padding: 20px;
// Default
background: $light-background-header;
@media (prefers-color-scheme: dark) {
background: $dark-background-header;
}
@media (prefers-color-scheme: light) {
background: $light-background-header;
}
[data-theme=dark] & {
background: $dark-background-header;
}
[data-theme=light] & {
background: $light-background-header;
}
&__right {
display: flex;
flex-direction: row;
align-items: center;
@media #{$media-size-phone} {
flex-direction: row-reverse;
}
}
&__inner {
display: flex;
align-items: center;
justify-content: space-between;
margin: 0 auto;
width: 760px;
max-width: 100%;
}
}
.theme-toggle {
display: flex;
align-items: center;
justify-content: center;
line-height: 1;
cursor: pointer;
}
.theme-toggler {
fill: currentColor;
}
.not-selectable {
user-select: none;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
}

@ -0,0 +1,85 @@
.posts {
width: 100%;
max-width: 800px;
text-align: left;
padding: 20px;
margin: 20px auto;
@media #{$media-size-tablet} {
max-width: 660px;
}
&:not(:last-of-type) {
// Default
border-bottom: 1px solid $light-border-color;
@media (prefers-color-scheme: dark) {
border-bottom: 1px solid $dark-border-color;
}
@media (prefers-color-scheme: light) {
border-bottom: 1px solid $light-border-color;
}
[data-theme=dark] & {
border-bottom: 1px solid $dark-border-color;
}
[data-theme=light] & {
border-bottom: 1px solid $light-border-color;
}
}
&-group {
display: flex;
margin-bottom: 1.9em;
line-height: normal;
@media #{$media-size-tablet} {
display: block;
}
}
&-list {
flex-grow: 1;
margin: 0;
padding: 0;
list-style: none;
}
.post {
&-title {
font-size: 1rem;
margin: 5px 0 5px 0;
}
&-year {
padding-top: 6px;
margin-right: 1.8em;
font-size: 1.6em;
@include dimmed;
@media #{$media-size-tablet} {
margin: -6px 0 4px;
}
}
&-item {
border-bottom: 1px grey dashed;
&-inner {
display: flex;
justify-content: space-between;
align-items: baseline;
padding: 12px 0;
text-decoration: none;
}
}
&-day {
flex-shrink: 0;
margin-left: 1em;
@include dimmed;
}
}
}

@ -0,0 +1,44 @@
.logo {
display: flex;
align-items: center;
text-decoration: none;
font-weight: bold;
font-display: auto;
font-family: monospace, monospace;
img {
height: 44px;
}
&__mark {
margin-right: 5px;
}
&__text {
font-size: 1.125rem;
white-space: nowrap;
}
&__cursor {
display: inline-block;
width: 10px;
height: 1rem;
background: #fe5186;
margin-left: 5px;
border-radius: 1px;
animation: cursor 1s infinite;
}
@media (prefers-reduced-motion: reduce) {
&__cursor {
animation: none;
}
}
}
@keyframes cursor {
0% { opacity: 0; }
50% { opacity: 1; }
100% { opacity: 0; }
}

@ -0,0 +1,435 @@
html {
box-sizing: border-box;
line-height: 1.6;
letter-spacing: 0.06em;
scroll-behavior: smooth;
}
*,
*:before,
*:after {
box-sizing: inherit;
}
body {
margin: 0;
padding: 0;
font-family: Inter, -apple-system, BlinkMacSystemFont, "Roboto",
"Segoe UI", Helvetica, Arial, sans-serif;
font-display: auto;
font-size: 1rem;
line-height: 1.54;
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
font-feature-settings: "liga", "tnum", "case", "calt", "zero", "ss01", "locl";
-webkit-overflow-scrolling: touch;
-webkit-text-size-adjust: 100%;
display: flex;
min-height: 100vh;
flex-direction: column;
// Default
background-color: $light-background;
color: $light-color;
@media #{$media-size-phone} {
font-size: 1rem;
}
@media (prefers-color-scheme: dark) {
background-color: $dark-background;
color: $dark-color;
}
@media (prefers-color-scheme: light) {
background-color: $light-background;
color: $light-color;
}
[data-theme=dark] & {
background-color: $dark-background;
color: $dark-color;
}
[data-theme=light] & {
background-color: $light-background;
color: $light-color;
}
}
h2,
h3,
h4,
h5,
h6 {
display: flex;
align-items: center;
line-height: 1.3;
}
h1 {
font-size: 2.625rem;
}
h2 {
font-size: 1.625rem;
margin-top: 2.5em;
}
h3 {
font-size: 1.375rem;
}
h4 {
font-size: 1.125rem;
}
@media #{$media-size-phone} {
h1 {
font-size: 2rem;
}
h2 {
font-size: 1.4rem;
}
h3 {
font-size: 1.15rem;
}
h4 {
font-size: 1.125rem;
}
}
a {
color: inherit;
}
img {
display: block;
max-width: 100%;
&.left {
margin-right: auto;
}
&.center {
margin-left: auto;
margin-right: auto;
}
&.right {
margin-left: auto;
}
&.circle {
border-radius: 50%;
max-width: 25%;
margin: auto;
}
}
figure {
display: table;
max-width: 100%;
margin: 25px 0;
&.left {
margin-right: auto;
}
&.left-floated {
margin-right: auto;
float: left;
img {
margin: 20px 20px 20px 0;
}
}
&.center {
margin-left: auto;
margin-right: auto;
}
&.right {
margin-left: auto;
}
&.right-floated {
margin-left: auto;
float: right;
img {
margin: 20px 0 20px 20px;
}
}
&.rounded {
img {
border-radius: 50%;
}
}
figcaption {
font-size: 14px;
margin-top: 5px;
opacity: 0.8;
&.left {
text-align: left;
}
&.center {
text-align: center;
}
&.right {
text-align: right;
}
}
}
em, i, strong {
// Default
color: $light-color-variant;
@media (prefers-color-scheme: dark) {
color: $dark-color-variant;
}
@media (prefers-color-scheme: light) {
color: $light-color-variant;
}
[data-theme=dark] & {
color: white;
}
[data-theme=light] & {
color: black;
}
}
code {
font-family: Consolas, Monaco, Andale Mono, Ubuntu Mono, monospace;
font-display: auto;
font-feature-settings: normal;
padding: 1px 6px;
margin: 0 2px;
border-radius: 5px;
font-size: 0.95rem;
// Default
background: $light-background-secondary;
@media (prefers-color-scheme: dark) {
background: $dark-background-secondary;
}
@media (prefers-color-scheme: light) {
background: $light-background-secondary;
}
[data-theme=dark] & {
background: $dark-background-secondary;
}
[data-theme=light] & {
background: $light-background-secondary;
}
}
pre {
[data-theme=dark] & {
background-color: $dark-background-secondary;
}
[data-theme=light] & {
background-color: $light-background-secondary;
}
padding: 10px 10px 10px 20px;
border-radius: 8px;
font-size: 0.95rem;
overflow: auto;
@media #{$media-size-phone} {
white-space: pre-wrap;
word-wrap: break-word;
}
code {
background: none !important;
margin: 0;
padding: 0;
font-size: inherit;
// Default
color: #ccc;
@media (prefers-color-scheme: dark) {
color: inherit;
}
@media (prefers-color-scheme: light) {
color: #ccc;
}
[data-theme=dark] & {
color: inherit;
}
[data-theme=light] & {
color: #ccc;
}
}
}
blockquote {
border-left: 3px solid #3eb0ef;
margin: 40px;
padding: 10px 20px;
@media #{$media-size-phone} {
margin: 10px;
padding: 10px;
}
&:before {
content: "";
font-family: Georgia, serif;
font-display: auto;
font-size: 3.875rem;
position: absolute;
left: -40px;
top: -20px;
}
p:first-of-type {
margin-top: 0;
}
p:last-of-type {
margin-bottom: 0;
}
}
ul,
ol {
margin-left: 40px;
padding: 0;
@media #{$media-size-phone} {
margin-left: 20px;
}
}
ol ol {
list-style-type: lower-alpha;
}
.container {
flex: 1 auto;
display: flex;
flex-direction: column;
justify-content: center;
text-align: center;
}
.content {
display: flex;
flex-direction: column;
flex: 1 auto;
align-items: center;
justify-content: center;
margin: 0;
@media #{$media-size-phone} {
margin-top: 0;
}
}
hr {
width: 100%;
border: none;
height: 1px;
// Default
background: $light-border-color;
@media (prefers-color-scheme: dark) {
background: $dark-border-color;
}
@media (prefers-color-scheme: light) {
background: $light-border-color;
}
[data-theme=dark] & {
background: $dark-border-color;
}
[data-theme=light] & {
background: $light-border-color;
}
}
.hidden {
display: none;
}
.hide-on-phone {
@media #{$media-size-phone} {
display: none;
}
}
.hide-on-tablet {
@media #{$media-size-tablet} {
display: none;
}
}
// Accessibility
.screen-reader-text {
border: 0;
clip: rect(1px, 1px, 1px, 1px);
clip-path: inset(50%);
height: 1px;
margin: -1px;
overflow: hidden;
padding: 0;
position: absolute !important;
width: 1px;
word-wrap: normal !important;
}
.screen-reader-text:focus {
background-color: #f1f1f1;
border-radius: 3px;
box-shadow: 0 0 2px 2px rgba(0, 0, 0, 0.6);
clip: auto !important;
clip-path: none;
color: #21759b;
display: block;
font-size: 14px;
font-size: 0.875rem;
font-weight: bold;
height: auto;
width: auto;
top: 5px;
left: 5px;
line-height: normal;
padding: 15px 23px 14px;
text-decoration: none;
z-index: 100000;
}
.background-image {
background-repeat: no-repeat;
background-attachment: fixed;
background-size: cover;
background-position: center center;
}
// Prism JS Additionals
.highlight {
margin: 30px auto;
}

@ -0,0 +1,165 @@
.menu {
z-index: 9999;
// Default
background: $light-background-header;
@media (prefers-color-scheme: dark) {
background: $dark-background-header;
}
@media (prefers-color-scheme: light) {
background: $light-background-header;
}
[data-theme=dark] & {
background: $dark-background-header;
}
[data-theme=light] & {
background: $light-background-header;
}
@media #{$media-size-phone} {
position: absolute;
top: 50px;
right: 0;
border: none;
margin: 0;
padding: 10px;
}
&__inner {
display: flex;
align-items: center;
justify-content: flex-start;
max-width: 100%;
margin: 0 auto;
padding: 0 15px;
font-size: 1rem;
list-style: none;
li {
margin: 0 12px;
}
@media #{$media-size-phone} {
flex-direction: column;
align-items: flex-start;
padding: 0;
li {
margin: 0;
padding: 5px;
}
}
}
&-trigger {
width: 24px;
height: 24px;
fill: currentColor;
margin-left: 10px;
cursor: pointer;
display: none;
@media #{$media-size-phone} {
display: block;
}
}
a {
display: inline-block;
margin-right: 15px;
text-decoration: none;
&:hover {
text-decoration: underline;
}
&:last-of-type {
margin-right: 0;
}
}
}
.submenu {
background: $light-background-header;
@media (prefers-color-scheme: dark) {
background: $dark-background-header;
}
@media (prefers-color-scheme: light) {
background: $light-background-header;
}
[data-theme=dark] & {
background: $dark-background-header;
}
[data-theme=light] & {
background: $light-background-header;
}
ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
}
li a, .dropbtn {
display: inline-block;
text-decoration: none;
}
li.dropdown {
display: inline-block;
}
.dropdown-content {
display: none;
position: absolute;
background: $dark-background-header;
@media (prefers-color-scheme: light) {
background: $light-background-header;
}
[data-theme=dark] & {
background: $dark-background-header;
}
[data-theme=light] & {
background: $light-background-header;
}
}
.dropdown-content a {
padding: 12px 20px;
text-decoration: none;
display: block;
text-align: left;
}
.dropdown-content a:hover {
background: $dark-background-header;
@media (prefers-color-scheme: light) {
background: $light-background-header;
}
[data-theme=dark] & {
background: $dark-background-header;
}
[data-theme=light] & {
background: $light-background-header;
}
}
.dropdown:hover .dropdown-content {
display: block;
}
}

@ -0,0 +1,3 @@
@mixin dimmed {
opacity: .6;
}

@ -0,0 +1,367 @@
/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */
/* Document
========================================================================== */
/**
* 1. Correct the line height in all browsers.
* 2. Prevent adjustments of font size after orientation changes in iOS.
*/
/* Webkit Scrollbar Customize */
::-webkit-scrollbar {
width: 8px;
height: 8px;
background: #212020;
}
::-webkit-scrollbar-thumb {
background: #888;
&:hover {
background: #dcdcdc;
}
}
html {
line-height: 1.15; /* 1 */
-webkit-text-size-adjust: 100%; /* 2 */
}
/* Sections
========================================================================== */
/**
* Remove the margin in all browsers.
*/
body {
margin: 0;
}
/**
* Render the `main` element consistently in IE.
*/
main {
display: block;
}
/**
* Correct the font size and margin on `h1` elements within `section` and
* `article` contexts in Chrome, Firefox, and Safari.
*/
h1 {
font-size: 2em;
margin: 0.67em 0;
}
/* Grouping content
========================================================================== */
/**
* 1. Add the correct box sizing in Firefox.
* 2. Show the overflow in Edge and IE.
*/
hr {
box-sizing: content-box; /* 1 */
height: 0; /* 1 */
overflow: visible; /* 2 */
}
/**
* 1. Correct the inheritance and scaling of font size in all browsers.
* 2. Correct the odd `em` font sizing in all browsers.
*/
pre {
font-family: monospace, monospace; /* 1 */
font-display: auto;
font-size: 1em; /* 2 */
}
/* Text-level semantics
========================================================================== */
/**
* Remove the gray background on active links in IE 10.
*/
a {
background-color: transparent;
}
/**
* 1. Remove the bottom border in Chrome 57-
* 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari.
*/
abbr[title] {
border-bottom: none; /* 1 */
text-decoration: underline; /* 2 */
text-decoration: underline dotted; /* 2 */
}
/**
* Add the correct font weight in Chrome, Edge, and Safari.
*/
b,
strong {
font-weight: bolder;
}
/**
* 1. Correct the inheritance and scaling of font size in all browsers.
* 2. Correct the odd `em` font sizing in all browsers.
*/
code,
kbd,
samp {
font-family: monospace, monospace; /* 1 */
font-display: auto;
font-size: 1em; /* 2 */
}
/**
* Add the correct font size in all browsers.
*/
small {
font-size: 80%;
}
/**
* Prevent `sub` and `sup` elements from affecting the line height in
* all browsers.
*/
sub,
sup {
font-size: 75%;
line-height: 0;
position: relative;
vertical-align: baseline;
}
sub {
bottom: -0.25em;
}
sup {
top: -0.5em;
}
/* Embedded content
========================================================================== */
/**
* Remove the border on images inside links in IE 10.
*/
img {
border-style: none;
}
/* Forms
========================================================================== */
/**
* 1. Change the font styles in all browsers.
* 2. Remove the margin in Firefox and Safari.
*/
button,
input,
optgroup,
select,
textarea {
font-family: inherit; /* 1 */
font-display: auto;
font-size: 100%; /* 1 */
line-height: 1.15; /* 1 */
margin: 0; /* 2 */
}
/**
* Show the overflow in IE.
* 1. Show the overflow in Edge.
*/
button,
input { /* 1 */
overflow: visible;
}
/**
* Remove the inheritance of text transform in Edge, Firefox, and IE.
* 1. Remove the inheritance of text transform in Firefox.
*/
button,
select { /* 1 */
text-transform: none;
}
/**
* Correct the inability to style clickable types in iOS and Safari.
*/
button,
[type="button"],
[type="reset"],
[type="submit"] {
-webkit-appearance: button;
}
/**
* Remove the inner border and padding in Firefox.
*/
button::-moz-focus-inner,
[type="button"]::-moz-focus-inner,
[type="reset"]::-moz-focus-inner,
[type="submit"]::-moz-focus-inner {
border-style: none;
padding: 0;
}
/**
* Restore the focus styles unset by the previous rule.
*/
button:-moz-focusring,
[type="button"]:-moz-focusring,
[type="reset"]:-moz-focusring,
[type="submit"]:-moz-focusring {
outline: 1px dotted ButtonText;
}
/**
* Correct the padding in Firefox.
*/
fieldset {
padding: 0.35em 0.75em 0.625em;
}
/**
* 1. Correct the text wrapping in Edge and IE.
* 2. Correct the color inheritance from `fieldset` elements in IE.
* 3. Remove the padding so developers are not caught out when they zero out
* `fieldset` elements in all browsers.
*/
legend {
box-sizing: border-box; /* 1 */
color: inherit; /* 2 */
display: table; /* 1 */
max-width: 100%; /* 1 */
padding: 0; /* 3 */
white-space: normal; /* 1 */
}
/**
* Add the correct vertical alignment in Chrome, Firefox, and Opera.
*/
progress {
vertical-align: baseline;
}
/**
* Remove the default vertical scrollbar in IE 10+.
*/
textarea {
overflow: auto;
}
/**
* 1. Add the correct box sizing in IE 10.
* 2. Remove the padding in IE 10.
*/
[type="checkbox"],
[type="radio"] {
box-sizing: border-box; /* 1 */
padding: 0; /* 2 */
}
/**
* Correct the cursor style of increment and decrement buttons in Chrome.
*/
[type="number"]::-webkit-inner-spin-button,
[type="number"]::-webkit-outer-spin-button {
height: auto;
}
/**
* 1. Correct the odd appearance in Chrome and Safari.
* 2. Correct the outline style in Safari.
*/
[type="search"] {
-webkit-appearance: textfield; /* 1 */
outline-offset: -2px; /* 2 */
}
/**
* Remove the inner padding in Chrome and Safari on macOS.
*/
[type="search"]::-webkit-search-decoration {
-webkit-appearance: none;
}
/**
* 1. Correct the inability to style clickable types in iOS and Safari.
* 2. Change font properties to `inherit` in Safari.
*/
::-webkit-file-upload-button {
-webkit-appearance: button; /* 1 */
font: inherit; /* 2 */
}
/* Interactive
========================================================================== */
/*
* Add the correct display in Edge, IE 10+, and Firefox.
*/
details {
display: block;
}
/*
* Add the correct display in all browsers.
*/
summary {
display: list-item;
}
/* Misc
========================================================================== */
/**
* Add the correct display in IE 10+.
*/
template {
display: none;
}
/**
* Add the correct display in IE 10.
*/
[hidden] {
display: none;
}

@ -0,0 +1,378 @@
/* PrismJS 1.23.0
https://prismjs.com/download.html#themes=prism-twilight&languages=markup+css+clike+javascript+ada+apacheconf+bash+batch+c+csharp+cpp+coffeescript+css-extras+dart+django+dns-zone-file+docker+elixir+etlua+erlang+git+go+graphql+groovy+haml+handlebars+haskell+http+hpkp+hsts+ini+java+javadoc+javadoclike+jsdoc+js-extras+json+json5+jsonp+julia+kotlin+latex+less+lisp+lua+markup-templating+matlab+nginx+objectivec+perl+php+phpdoc+php-extras+powershell+promql+protobuf+puppet+purescript+python+r+jsx+tsx+regex+rest+ruby+rust+sass+scss+shell-session+sql+stylus+swift+toml+twig+typescript+typoscript+verilog+vhdl+vim+visual-basic+wasm+xml-doc+yaml&plugins=line-highlight+line-numbers+show-language+toolbar */
/**
* prism.js Twilight theme
* Based (more or less) on the Twilight theme originally of Textmate fame.
* @author Remy Bach
*/
code[class*="language-"],
pre[class*="language-"] {
color: white;
background: none;
font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
font-size: 1em;
text-align: left;
text-shadow: 0 -.1em .2em black;
white-space: pre;
word-spacing: normal;
word-break: normal;
word-wrap: normal;
line-height: 1.5;
-moz-tab-size: 4;
-o-tab-size: 4;
tab-size: 4;
-webkit-hyphens: none;
-moz-hyphens: none;
-ms-hyphens: none;
hyphens: none;
}
pre[class*="language-"],
:not(pre) > code[class*="language-"] {
background: hsl(0, 0%, 8%); /* #141414 */
}
/* Code blocks */
pre[class*="language-"] {
border-radius: .5em;
border: .3em solid hsl(0, 0%, 33%); /* #282A2B */
box-shadow: 1px 1px .5em black inset;
margin: .5em 0;
overflow: auto;
padding: 1em;
}
pre[class*="language-"]::-moz-selection {
/* Firefox */
background: hsl(200, 4%, 16%); /* #282A2B */
}
pre[class*="language-"]::selection {
/* Safari */
background: hsl(200, 4%, 16%); /* #282A2B */
}
/* Text Selection colour */
pre[class*="language-"]::-moz-selection, pre[class*="language-"] ::-moz-selection,
code[class*="language-"]::-moz-selection, code[class*="language-"] ::-moz-selection {
text-shadow: none;
background: hsla(0, 0%, 93%, 0.15); /* #EDEDED */
}
pre[class*="language-"]::selection, pre[class*="language-"] ::selection,
code[class*="language-"]::selection, code[class*="language-"] ::selection {
text-shadow: none;
background: hsla(0, 0%, 93%, 0.15); /* #EDEDED */
}
/* Inline code */
:not(pre) > code[class*="language-"] {
border-radius: .3em;
border: .13em solid hsl(0, 0%, 33%); /* #545454 */
box-shadow: 1px 1px .3em -.1em black inset;
padding: .15em .2em .05em;
white-space: normal;
}
.token.comment,
.token.prolog,
.token.doctype,
.token.cdata {
color: hsl(0, 0%, 47%); /* #777777 */
}
.token.punctuation {
opacity: .7;
}
.token.namespace {
opacity: .7;
}
.token.tag,
.token.boolean,
.token.number,
.token.deleted {
color: hsl(14, 58%, 55%); /* #CF6A4C */
}
.token.keyword,
.token.property,
.token.selector,
.token.constant,
.token.symbol,
.token.builtin {
color: hsl(53, 89%, 79%); /* #F9EE98 */
}
.token.attr-name,
.token.attr-value,
.token.string,
.token.char,
.token.operator,
.token.entity,
.token.url,
.language-css .token.string,
.style .token.string,
.token.variable,
.token.inserted {
color: hsl(76, 21%, 52%); /* #8F9D6A */
}
.token.atrule {
color: hsl(218, 22%, 55%); /* #7587A6 */
}
.token.regex,
.token.important {
color: hsl(42, 75%, 65%); /* #E9C062 */
}
.token.important,
.token.bold {
font-weight: bold;
}
.token.italic {
font-style: italic;
}
.token.entity {
cursor: help;
}
pre[data-line] {
padding: 1em 0 1em 3em;
position: relative;
}
/* Markup */
.language-markup .token.tag,
.language-markup .token.attr-name,
.language-markup .token.punctuation {
color: hsl(33, 33%, 52%); /* #AC885B */
}
/* Make the tokens sit above the line highlight so the colours don't look faded. */
.token {
position: relative;
z-index: 1;
}
.line-highlight {
background: hsla(0, 0%, 33%, 0.25); /* #545454 */
background: linear-gradient(to right, hsla(0, 0%, 33%, .1) 70%, hsla(0, 0%, 33%, 0)); /* #545454 */
border-bottom: 1px dashed hsl(0, 0%, 33%); /* #545454 */
border-top: 1px dashed hsl(0, 0%, 33%); /* #545454 */
left: 0;
line-height: inherit;
margin-top: 0.75em; /* Same as .prisms padding-top */
padding: inherit 0;
pointer-events: none;
position: absolute;
right: 0;
white-space: pre;
z-index: 0;
}
.line-highlight:before,
.line-highlight[data-end]:after {
background-color: hsl(215, 15%, 59%); /* #8794A6 */
border-radius: 999px;
box-shadow: 0 1px white;
color: hsl(24, 20%, 95%); /* #F5F2F0 */
content: attr(data-start);
font: bold 65%/1.5 sans-serif;
left: .6em;
min-width: 1em;
padding: 0 .5em;
position: absolute;
text-align: center;
text-shadow: none;
top: .4em;
vertical-align: .3em;
}
.line-highlight[data-end]:after {
bottom: .4em;
content: attr(data-end);
top: auto;
}
pre[data-line] {
position: relative;
padding: 1em 0 1em 3em;
}
.line-highlight {
position: absolute;
left: 0;
right: 0;
padding: inherit 0;
margin-top: 1em; /* Same as .prisms padding-top */
background: hsla(24, 20%, 50%,.08);
background: linear-gradient(to right, hsla(24, 20%, 50%,.1) 70%, hsla(24, 20%, 50%,0));
pointer-events: none;
line-height: inherit;
white-space: pre;
}
@media print {
.line-highlight {
/*
* This will prevent browsers from replacing the background color with white.
* It's necessary because the element is layered on top of the displayed code.
*/
-webkit-print-color-adjust: exact;
color-adjust: exact;
}
}
.line-highlight:before,
.line-highlight[data-end]:after {
content: attr(data-start);
position: absolute;
top: .4em;
left: .6em;
min-width: 1em;
padding: 0 .5em;
background-color: hsla(24, 20%, 50%,.4);
color: hsl(24, 20%, 95%);
font: bold 65%/1.5 sans-serif;
text-align: center;
vertical-align: .3em;
border-radius: 999px;
text-shadow: none;
box-shadow: 0 1px white;
}
.line-highlight[data-end]:after {
content: attr(data-end);
top: auto;
bottom: .4em;
}
.line-numbers .line-highlight:before,
.line-numbers .line-highlight:after {
content: none;
}
pre[id].linkable-line-numbers span.line-numbers-rows {
pointer-events: all;
}
pre[id].linkable-line-numbers span.line-numbers-rows > span:before {
cursor: pointer;
}
pre[id].linkable-line-numbers span.line-numbers-rows > span:hover:before {
background-color: rgba(128, 128, 128, .2);
}
pre[class*="language-"].line-numbers {
position: relative;
padding-left: 3.8em;
counter-reset: linenumber;
}
pre[class*="language-"].line-numbers > code {
position: relative;
white-space: inherit;
}
.line-numbers .line-numbers-rows {
position: absolute;
pointer-events: none;
top: 0;
font-size: 100%;
left: -3.8em;
width: 3em; /* works for line-numbers below 1000 lines */
letter-spacing: -1px;
border-right: 1px solid #999;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.line-numbers-rows > span {
display: block;
counter-increment: linenumber;
}
.line-numbers-rows > span:before {
content: counter(linenumber);
color: #999;
display: block;
padding-right: 0.8em;
text-align: right;
}
div.code-toolbar {
position: relative;
}
div.code-toolbar > .toolbar {
position: absolute;
top: .3em;
right: .2em;
transition: opacity 0.3s ease-in-out;
opacity: 0;
}
div.code-toolbar:hover > .toolbar {
opacity: 1;
}
/* Separate line b/c rules are thrown out if selector is invalid.
IE11 and old Edge versions don't support :focus-within. */
div.code-toolbar:focus-within > .toolbar {
opacity: 1;
}
div.code-toolbar > .toolbar .toolbar-item {
display: inline-block;
}
div.code-toolbar > .toolbar a {
cursor: pointer;
}
div.code-toolbar > .toolbar button {
background: none;
border: 0;
color: inherit;
font: inherit;
line-height: normal;
overflow: visible;
padding: 0;
-webkit-user-select: none; /* for button */
-moz-user-select: none;
-ms-user-select: none;
}
div.code-toolbar > .toolbar a,
div.code-toolbar > .toolbar button,
div.code-toolbar > .toolbar span {
color: #bbb;
font-size: .8em;
padding: 0 .5em;
background: #f5f2f0;
background: rgba(224, 224, 224, 0.2);
box-shadow: 0 2px 0 0 rgba(0,0,0,0.2);
border-radius: .5em;
}
div.code-toolbar > .toolbar a:hover,
div.code-toolbar > .toolbar a:focus,
div.code-toolbar > .toolbar button:hover,
div.code-toolbar > .toolbar button:focus,
div.code-toolbar > .toolbar span:hover,
div.code-toolbar > .toolbar span:focus {
color: inherit;
text-decoration: none;
}

@ -0,0 +1,34 @@
.sharing-buttons {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
.resp-sharing-button__icon,
.resp-sharing-button__link {
display: inline-block;
}
.resp-sharing-button__link {
text-decoration: none;
margin: 0.5em;
}
.resp-sharing-button {
border-radius: 5px;
transition: 25ms ease-out;
padding: 0.5em 0.75em;
font-family: Helvetica Neue,Helvetica,Arial,sans-serif;
}
.resp-sharing-button__icon svg {
width: 1em;
height: 1em;
margin-right: 0.4em;
vertical-align: top;
}
.resp-sharing-button--small svg {
margin: 0;
vertical-align: middle;
}
}

@ -0,0 +1,234 @@
.post {
width: 100%;
max-width: 800px;
text-align: left;
padding: 20px;
margin: 20px auto;
@media #{$media-size-tablet} {
max-width: 600px;
}
&-date {
&:after {
content: '';
}
}
&-title {
font-size: 2.625rem;
margin: 0 0 20px;
@media #{$media-size-phone} {
font-size: 2rem;
}
a {
text-decoration: none;
}
}
&-tags {
display: block;
margin-bottom: 20px;
font-size: 1rem;
opacity: 0.5;
a {
text-decoration: none;
}
}
&-content {
margin-top: 30px;
}
&-cover {
border-radius: 8px;
margin: 40px -50px;
width: $max-width;
max-width: $max-width;
overflow: hidden;
@media #{$media-size-tablet} {
margin: 20px 0;
width: 100%;
}
}
&-excerpt {
color: grey;
font-style: italic;
}
&-info {
margin-top: 30px;
font-size: 0.8rem;
line-height: normal;
@include dimmed;
p {
margin: 0.8em 0;
}
a:hover {
border-bottom: 1px solid white;
}
svg {
margin-right: 0.8em;
}
.tag {
margin-right: 0.5em;
&::before {
content: "#";
}
}
.feather {
display: inline-block;
vertical-align: -.125em;
width: 1em;
height: 1em;
}
}
&-audio {
display: flex;
justify-content: center;
align-items: center;
padding-top: 20px;
audio {
width: 90%;
}
}
.flag {
border-radius: 50%;
margin: 0 5px;
}
}
.pagination {
margin-top: 20px;
&__title {
display: flex;
text-align: center;
position: relative;
margin: 20px 0;
&-h {
text-align: center;
margin: 0 auto;
padding: 5px 10px;
font-size: 0.8rem;
text-transform: uppercase;
text-decoration: none;
letter-spacing: 0.1em;
z-index: 1;
// Default
background: $light-background;
color: $light-color-secondary;
@media (prefers-color-scheme: dark) {
background: $dark-background;
color: $dark-color-secondary;
}
@media (prefers-color-scheme: light) {
background: $light-background;
color: $light-color-secondary;
}
[data-theme=dark] & {
background: $dark-background;
color: $dark-color-secondary;
}
[data-theme=light] & {
background: $light-background;
color: $light-color-secondary;
}
}
hr {
position: absolute;
left: 0;
right: 0;
width: 100%;
margin-top: 15px;
z-index: 0;
}
}
&__buttons {
display: flex;
align-items: center;
justify-content: center;
a {
text-decoration: none;
font-weight: bold;
}
}
}
.button {
position: relative;
display: inline-flex;
align-items: center;
justify-content: center;
font-size: 1rem;
font-weight: 600;
border-radius: 8px;
max-width: 40%;
padding: 0;
cursor: pointer;
appearance: none;
// Default
background: $light-background-secondary;
@media (prefers-color-scheme: dark) {
background: $dark-background-secondary;
}
@media (prefers-color-scheme: light) {
background: $light-background-secondary;
}
[data-theme=dark] & {
background: $dark-background-secondary;
}
[data-theme=light] & {
background: $light-background-secondary;
}
+ .button {
margin-left: 10px;
}
a {
display: flex;
padding: 8px 16px;
text-decoration: none;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
}
&__text {
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
}
&.next .button__icon {
margin-left: 8px;
}
&.previous .button__icon {
margin-right: 8px;
}
}

@ -0,0 +1,84 @@
.post-content {
table {
border-collapse: collapse;
margin: 25px auto;
font-size: 0.9em;
min-width: 400px;
max-width: 100%;
th,
td {
padding: 12px 15px;
// Default
border: 1px solid $light-table-color;
@media (prefers-color-scheme: dark) {
border: 1px solid $dark-table-color;
}
@media (prefers-color-scheme: light) {
border: 1px solid $light-table-color;
}
[data-theme=dark] & {
border: 1px solid $dark-table-color;
}
[data-theme=light] & {
border: 1px solid $light-table-color;
}
}
thead {
tr {
text-align: left;
// Default
background-color: $light-table-color;
color: $light-color;
@media (prefers-color-scheme: dark) {
background-color: $dark-table-color;
color: $dark-color;
}
@media (prefers-color-scheme: light) {
background-color: $light-table-color;
color: $light-color;
}
[data-theme=dark] & {
background-color: $dark-table-color;
color: $dark-color;
}
[data-theme=light] & {
background-color: $light-table-color;
color: $light-color;
}
}
}
tbody {
tr {
// Default
border: 1px solid $light-table-color;
@media (prefers-color-scheme: dark) {
border: 1px solid $dark-table-color;
}
@media (prefers-color-scheme: light) {
border: 1px solid $light-table-color;
}
[data-theme=dark] & {
border: 1px solid $dark-table-color;
}
[data-theme=light] & {
border: 1px solid $light-table-color;
}
}
}
}
}

@ -0,0 +1,33 @@
@charset "UTF-8";
/* Light theme color */
$light-background: #fff;
$light-background-secondary: #eaeaea;
$light-background-header: #fafafa;
$light-color: #222;
$light-color-variant: black;
$light-color-secondary: #999;
$light-border-color: #dcdcdc;
$light-table-color: #dcdcdc;
/* Dark theme colors */
$dark-background: #232425;
$dark-background-secondary: #3b3d42;
$dark-background-header: #1b1c1d;
$dark-color: #a9a9b3;
$dark-color-variant: white;
$dark-color-secondary: #b3b3bd;
$dark-border-color: #4e4e57;
$dark-table-color: #4e4e57;
$media-size-phone: "(max-width: 684px)";
$media-size-tablet: "(max-width: 900px)";
/* Variables for js, must be the same as these in @custom-media queries */
:root {
--phoneWidth: (max-width: 684px);
--tabletWidth: (max-width: 900px);
}
/* Content */
$max-width: 860px;

@ -0,0 +1,21 @@
/* Must be loaded before everything else */
@import "normalize";
@import "prism";
@import "flag-icons";
/* Main stuff */
@import "variables";
@import "mixins";
@import "fonts";
@import "buttons";
/* Modules */
@import "header";
@import "logo";
@import "menu";
@import "main";
@import "list";
@import "single";
@import "footer";
@import "sharing-buttons";
@import "tables";
@import "404";

@ -0,0 +1,19 @@
de: de
en: gb
es: es
fr: fr
gl: es-ga
hi: in
id: id
it: it
ja: jp
ml: in
nl: nl
pt-br: br
ru: ru
tr: tr
uk: uk
zh-cn: cn
zh-hk: hk
zh-tw: tw
ro: ro

@ -0,0 +1,15 @@
# Configuration
There are some settings you can set in your `config.toml`.
## Default area
The settings in the default area are usually provided by Hugo itself. Check [Configure Hugo](https://gohugo.io/getting-started/configuration/#all-configuration-settings) for more information. But I want to list some important things here which are relevant to this theme.
### paginate
```
paginate = 10
```
This setting will paginate your list views. Set to `0` to disable it. For more information check (https://gohugo.io/templates/pagination/).

@ -0,0 +1,13 @@
# Favicons
Use [RealFaviconGenerator](https://realfavicongenerator.net/) to generate these files, put them into your site's static folder:
- android-chrome-192x192.png
- android-chrome-512x512.png
- apple-touch-icon.png
- favicon-16x16.png
- favicon-32x32.png
- favicon.ico
- mstile-150x150.png
- safari-pinned-tab.svg
- site.webmanifest

@ -0,0 +1,87 @@
# Available Social Icons:
- [amazon](https://simpleicons.org/?q=amazon)
- [anilist](https://simpleicons.org/?q=anilist)
- [box](https://simpleicons.org/?q=box)
- [behance](https://simpleicons.org/?q=behance)
- [bitbucket](https://simpleicons.org/?q=bitbucket)
- case - generic briefcase icon for work based links
- [codesandbox](https://simpleicons.org/?q=codesandbox)
- [codechef](https://simpleicons.org/?q=codechef)
- [codepen](https://simpleicons.org/?q=codepen)
- [cs:go](https://simpleicons.org/?q=counterstrike)
- dev
- [deviantart](https://simpleicons.org/?q=deviantart)
- [discogs](https://simpleicons.org/?q=discogs)
- [discord](https://simpleicons.org/?q=discord)
- [docker](https://simpleicons.org/?q=docker)
- [dribbble](https://simpleicons.org/?q=dribbble)
- [duolingo](https://simpleicons.org/?q=duolingo)
- [email](https://feathericons.com/?query=mail)
- [facebook](https://simpleicons.org/?q=facebook)
- [facebook-messenger](https://simpleicons.org/?q=messenger)
- [fitbit](https://simpleicons.org/?q=fitbit)
- git
- [gitbook](https://simpleicons.org/?q=gitbook)
- [gitea](https://simpleicons.org/?q=gitea)
- [github](https://feathericons.com/?query=github)
- [gitlab](https://feathericons.com/?query=gitlab)
- [gitter](https://simpleicons.org/icons/gitter.svg)
- [goodreads](https://simpleicons.org/?q=goodreads)
- [googleplay](https://simpleicons.org/?q=googleplay)
- [googlescholar](https://simpleicons.org/?q=googlescholar)
- gpg
- [hackerone](https://simpleicons.org/?q=hackerone)
- [hackerrank](https://simpleicons.org/?q=hackerrank)
- [hackthebox](https://simpleicons.org/?q=hackthebox)
- [imdb](https://simpleicons.org/?q=imdb)
- [instagram](https://feathericons.com/?query=instagram)
- [itch.io](https://simpleicons.org/?q=itch.io)
- [jenkins](https://feathericons.com/?query=jenkins)
- [kaggle](https://simpleicons.org/?q=kaggle)
- [keybase](https://simpleicons.org/?q=keybase)
- [lastfm](https://simpleicons.org/?q=lastfm)
- [leetcode](https://simpleicons.org/?q=leetcode)
- [letterboxd](https://simpleicons.org/?q=letterboxd)
- [librepay](https://simpleicons.org/?q=liberapay)
- [lichess](https://simpleicons.org/?q=lichess)
- [linkedin](https://feathericons.com/?query=linked)
- [mastodon](https://simpleicons.org/?q=mastodon)
- [matrix](https://simpleicons.org/?q=matrix)
- [medium](https://simpleicons.org/?q=medium)
- [mixcloud](https://simpleicons.org/?q=mixcloud)
- [npm](https://simpleicons.org/?q=npm)
- [opencollective](https://simpleicons.org/?q=opencollective)
- [orcid](https://simpleicons.org/?q=orcid)
- [patreon](https://simpleicons.org/?q=patreon)
- [paypal](https://simpleicons.org/?q=paypal)
- [peertube](https://simpleicons.org/?q=peertube)
- [pinterest](https://simpleicons.org/?q=pinterest)
- [pixelfed](https://github.com/pixelfed/pixelfed/blob/dev/public/img/pixelfed-icon-black.svg)
- [podcasts-apple](https://simpleicons.org/?q=podcast)
- [podcasts-google](https://simpleicons.org/?q=podcast)
- [polywork](https://simpleicons.org/?q=polywork)
- [reddit](https://simpleicons.org/?q=reddit)
- [researchgate](https://simpleicons.org/?q=researchgate)
- [revolut](https://simpleicons.org/?q=revolut)
- [signal](https://simpleicons.org/?q=signal)
- [slack](https://simpleicons.org/?q=slack)
- [soundcloud](https://simpleicons.org/?q=soundcloud)
- [spotify](https://simpleicons.org/?q=spotify)
- [stackoverflow](https://simpleicons.org/?q=stackoverflow)
- [steam](https://simpleicons.org/?q=Steam)
- [strava](https://simpleicons.org/?q=strava)
- [telegram](https://simpleicons.org/?q=telegram)
- [threema](https://simpleicons.org/?q=threema)
- [tryhackme](https://simpleicons.org/?q=tryhackme)
- [tumblr](https://simpleicons.org/?q=tumblr)
- [twitch](https://simpleicons.org/?q=twitch)
- [twitter](https://simpleicons.org/?q=twitter)
- [unsplash](https://simpleicons.org/?q=unsplash)
- [whatsapp](https://simpleicons.org/?q=whatsapp)
- [xampp](https://simpleicons.org/?q=xampp)
- [xda](https://simpleicons.org/?q=xda)
- [xing](https://simpleicons.org/?q=xing)
- [xmpp](https://simpleicons.org/?q=xmpp)
- [ycombinator](https://simpleicons.org/?q=ycombinator)
- [youtube](https://simpleicons.org/?q=youtube)

@ -0,0 +1,206 @@
baseURL = "https://example.com"
title = "Hello Friend NG"
languageCode = "en-us"
theme = "hello-friend-ng"
PygmentsCodeFences = true
PygmentsStyle = "monokai"
paginate = 10
rssLimit = 10 # Maximum number of items in the RSS feed.
copyright = "This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License." # This message is only used by the RSS template.
# googleAnalytics = ""
# disqusShortname = ""
archetypeDir = "archetypes"
contentDir = "content"
dataDir = "data"
layoutDir = "layouts"
publishDir = "public"
buildDrafts = false
buildFuture = false
buildExpired = false
canonifyURLs = true
enableRobotsTXT = true
enableGitInfo = false
enableEmoji = true
enableMissingTranslationPlaceholders = false
disableRSS = false
disableSitemap = false
disable404 = false
disableHugoGeneratorInject = false
[permalinks]
posts = "/posts/:year/:month/:title/"
[author]
name = "Jane Doe"
[blackfriday]
hrefTargetBlank = true
[taxonomies]
tag = "tags"
category = "categories"
series = "series"
[params]
dateform = "Jan 2, 2006"
dateformShort = "Jan 2"
dateformNum = "2006-01-02"
dateformNumTime = "2006-01-02 15:04"
# Metadata mostly used in document's head
#
description = "Nice theme for homepages and blogs"
keywords = ""
images = [""]
# Home subtitle of the index page.
#
homeSubtitle = "Hello Friend NG"
# Set a background for the homepage
# backgroundImage = "assets/images/background.jpg"
# Prefix of link to the git commit detail page. GitInfo must be enabled.
#
# gitUrl = ""
# Set disableReadOtherPosts to true in order to hide the links to other posts.
#
disableReadOtherPosts = false
# Enable theme toggle
#
# This options enables the theme toggle for the theme.
# Per default, this option is off.
# The theme is respecting the prefers-color-scheme of the operating systeme.
# With this option on, the page user is able to set the scheme he wants.
enableThemeToggle = false
# Sharing buttons
#
# There are a lot of buttons preconfigured. If you want to change them,
# generate the buttons here: https://sharingbuttons.io
# and add them into your own `layouts/partials/sharing-buttons.html`
#
enableSharingButtons = true
# Global language menu
#
# Enables the global language menu.
#
enableGlobalLanguageMenu = true
# Integrate Javascript files or stylesheets by adding the url to the external assets or by
# linking local files with their path relative to the static folder, e.g. "css/styles.css"
#
customCSS = []
customJS = []
# Toggle this option need to rebuild SCSS, requires extended version of Hugo
#
justifyContent = false # Set "text-align: justify" to .post-content.
# Integrate Plausible.io
# plausibleDataDomain = 'test.com'
# plausibleScriptSource = 'https://plausible.io/js/script.js'
# Custom footer
# If you want, you can easily override the default footer with your own content.
#
[params.footer]
trademark = true
rss = true
copyright = true
author = true
topText = []
bottomText = [
"Powered by <a href=\"http://gohugo.io\">Hugo</a>",
"Made with &#10084; by <a href=\"https://github.com/rhazdon\">Djordje Atlialp</a>"
]
# Colors for favicons
#
[params.favicon.color]
mask = "#1b1c1d"
msapplication = "#1b1c1d"
theme = "#1b1c1d"
[params.logo]
logoMark = ">"
logoText = "$ cd /home/"
logoHomeLink = "/"
# Set true to remove the logo cursor entirely.
# logoCursorDisabled = false
# Set to a valid CSS color to change the cursor in the logo.
# logoCursorColor = "#67a2c9"
# Set to a valid CSS time value to change the animation duration, "0s" to disable.
# logoCursorAnimate = "2s"
# Append the current url pathname to logoText
# logoCursorPathname = true
# Commento is more than just a comments widget you can embed —
# its a return to the roots of the internet.
# An internet without the tracking and invasions of privacy.
# An internet that is simple and lightweight.
# An internet that is focused on interesting discussions, not ads.
# A better internet.
# Uncomment this to enable Commento.
#
# [params.commento]
# url = ""
# Uncomment this if you want a portrait on your start page
#
# [params.portrait]
# path = "/img/image.jpg"
# alt = "Portrait"
# maxWidth = "50px"
# Social icons
[[params.social]]
name = "twitter"
url = "https://twitter.com/"
[[params.social]]
name = "email"
url = "mailto:nobody@example.com"
[[params.social]]
name = "github"
url = "https://github.com/"
[[params.social]]
name = "linkedin"
url = "https://www.linkedin.com/"
[[params.social]]
name = "stackoverflow"
url = "https://www.stackoverflow.com/"
[languages]
[languages.en]
subtitle = "Hello Friend NG Theme"
weight = 1
copyright = '<a href="https://creativecommons.org/licenses/by-nc/4.0/" target="_blank" rel="noopener">CC BY-NC 4.0</a>'
[languages.fr]
subtitle = "Hello Friend NG Theme"
weight = 2
copyright = '<a href="https://creativecommons.org/licenses/by-nc/4.0/" target="_blank" rel="noopener">CC BY-NC 4.0</a>'
[menu]
[[menu.main]]
identifier = "about"
name = "About"
url = "about/"
[[menu.main]]
identifier = "posts"
name = "Posts"
url = "posts/"

@ -0,0 +1,19 @@
+++
title = "About"
date = "2014-04-09"
aliases = ["about-us","about-hugo","contact"]
[ author ]
name = "Hugo Authors"
+++
Hugo is the **worlds fastest framework for building websites**. It is written in Go.
It makes use of a variety of open source projects including:
* https://github.com/russross/blackfriday
* https://github.com/alecthomas/chroma
* https://github.com/muesli/smartcrop
* https://github.com/spf13/cobra
* https://github.com/spf13/viper
Learn more and contribute on [GitHub](https://github.com/gohugoio).

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -0,0 +1,352 @@
+++
categories = ["Go"]
date = "2014-04-02"
description = ""
featured = "pic02.jpg"
featuredalt = ""
featuredpath = "date"
linktitle = ""
slug = "Introduction aux modeles Hugo"
title = "Introduction aux modèles (Hu)go"
type = ["posts","post"]
[ author ]
name = "Michael Henderson"
+++
Hugo utilise l'excellente librairie [go][] [html/template][gohtmltemplate] pour
son moteur de modèles. c'est un moteur extrêmement léger qui offre un très petit
nombre de fonctions logiques. À notre expérience, c'est juste ce qu'il faut pour
créer un bon site web statique. Si vous avez déjà utilisé d'autre moteurs de
modèles pour différents langages ou frameworks, vous allez retrouver beaucoup de
similitudes avec les modèles go.
Ce document est une introduction sur l'utilisation de Go templates. La
[documentation go][gohtmltemplate] fourni plus de détails.
## Introduction aux modèles Go
Go templates fournit un langage de modèles très simple. Il adhère à la
conviction que les modèles ou les vues doivent avoir une logique des plus
élémentaires. L'une des conséquences de cette simplicité est que les modèles
seront plus rapides a être analysés.
Une caractéristique unique de Go templates est qu'il est conscient du contenu.
Les variables et le contenu va être nettoyé suivant le contexte d'utilisation.
Plus de détails sont disponibles dans la [documentation go][gohtmltemplate].
## Syntaxe basique
Les modèles en langage Go sont des fichiers HTML avec l'ajout de variables et
fonctions.
**Les variables Go et les fonctions sont accessibles avec {{ }}**
Accès à une variable prédéfinie "foo":
{{ foo }}
**Les paramètres sont séparés par des espaces**
Appel de la fonction add avec 1 et 2 en argument**
{{ add 1 2 }}
**Les méthodes et les champs sont accessibles par un point**
Accès au paramètre de la page "bar"
{{ .Params.bar }}
**Les parenthèses peuvent être utilisées pour grouper des éléments ensemble**
```
{{ if or (isset .Params "alt") (isset .Params "caption") }} Caption {{ end }}
```
## Variables
Chaque modèle go a une structure (objet) mis à sa disposition. Avec Hugo, à
chaque modèle est passé soit une page, soit une structure de nœud, suivant quel
type de page vous rendez. Plus de détails sont disponibles sur la page des
[variables](/layout/variables).
Une variable est accessible par son nom.
<title>{{ .Title }}</title>
Les variables peuvent également être définies et appelées.
{{ $address := "123 Main St."}}
{{ $address }}
## Functions
Go templace est livré avec quelques fonctions qui fournissent des
fonctionnalités basiques. Le système de Go template fourni également un
mécanisme permettant aux applications d'étendre les fonctions disponible. Les
[fonctions de modèle Hugo](/layout/functions) fourni quelques fonctionnalités
supplémentaires que nous espérons qu'elles seront utiles pour vos sites web.
Les functions sont appelées en utilisant leur nom suivi par les paramètres
requis séparés par des espaces. Des fonctions de modèles ne peuvent pas être
ajoutées sans recompiler Hugo.
**Exemple:**
{{ add 1 2 }}
## Inclusions
Lorsque vous incluez un autre modèle, vous devez y passer les données qu'il sera
en mesure d'accèder. Pour passer le contexte actuel, pensez à ajouter un point.
La localisation du modèle sera toujours à partir du répertoire /layout/ dans
Hugo.
**Exemple:**
{{ template "chrome/header.html" . }}
## Logique
Go templates fourni les itérations et la logique conditionnèle des plus basique.
### Itération
Comme en go, les modèles go utilisent fortement *range* pour itérer dans une
map, un array ou un slice. Les exemples suivant montre différentes façons
d'utiliser *range*
**Exemple 1: En utilisant le context**
{{ range array }}
{{ . }}
{{ end }}
**Exemple 2: En déclarant un nom de variable**
{{range $element := array}}
{{ $element }}
{{ end }}
**Exemple 2: En déclarant un nom de varialbe pour la clé et la valeur**
{{range $index, $element := array}}
{{ $index }}
{{ $element }}
{{ end }}
### Conditions
*If*, *else*, *with*, *or*, *&*, *and* fournissent la base pour la logique
conditionnelle avec Go templates. Comme *range*, chaque déclaration est fermé
avec `end`.
Go templates considère les valeurs suivante comme *false* :
* false
* 0
* tout array, slice, map ou chaine d'une longueur de zéro
**Exemple 1: If**
{{ if isset .Params "title" }}<h4>{{ index .Params "title" }}</h4>{{ end }}
**Exemple 2: If -> Else**
{{ if isset .Params "alt" }}
{{ index .Params "alt" }}
{{else}}
{{ index .Params "caption" }}
{{ end }}
**Exemple 3: And & Or**
```
{{ if and (or (isset .Params "title") (isset .Params "caption"))
(isset .Params "attr")}}
```
**Exemple 4: With**
Une manière alternative d'écrire un "if" et de référencer cette même valeur est
d'utiliser "with". Cela permet de remplacer le contexte `.` par cet valeur et
saute le bloc si la variable est absente.
Le premier exemple peut être simplifié à ceci :
{{ with .Params.title }}<h4>{{ . }}</h4>{{ end }}
**Exemple 5: If -> Else If**
{{ if isset .Params "alt" }}
{{ index .Params "alt" }}
{{ else if isset .Params "caption" }}
{{ index .Params "caption" }}
{{ end }}
## *Pipes*
L'un des composants le plus puissant de Go templates est la capacité d'empiler
les action l'une après l'autre. Cela est fait en utilisant les *pipes*.
Empruntés aux *pipes* unix, le concept est simple. Chaque sortie de *pipeline*
devient l'entrée du *pipe* suivant.
À cause de la syntaxe très simple de Go templates, le *pipe* est essentiel pour
être capable d'enchainer les appels de fonctions. Une limitation des *pipes*
est qu'il ne peuvent fonctionner seulement avec une seule valeur et cette valeur
devient le dernier paramètre du prochain *pipeline*.
Quelques exemples simple devrait vous aider à comprendre comment utiliser les
*pipes*.
**Exemple 1 :**
{{ if eq 1 1 }} Same {{ end }}
est identique à
{{ eq 1 1 | if }} Same {{ end }}
Il semble étrange de placer le *if* à la fin, mais il fournit une bonne
illustration de la façon d'utiliser les tuyaux.
**Exemple 2 :**
{{ index .Params "disqus_url" | html }}
Accès au paramètre de page nommé "disqus_url" et échappement du HTML
**Exemple 3 :**
```
{{ if or (or (isset .Params "title") (isset .Params "caption"))
(isset .Params "attr")}}
Stuff Here
{{ end }}
```
Peut être réécrit en
```
{{ isset .Params "caption" | or isset .Params "title" |
or isset .Params "attr" | if }}
Stuff Here
{{ end }}
```
## Contexte (alias. le point)
Le concept le plus facilement négligé pour comprendre les modèles go est que
{{ . }} fait toujours référence au contexte actuel. Dans le plus haut niveau de
votre modèle, ce sera l'ensemble des données mis à votre disposition. Dans une
itération, ce sera la valeur de l'élément actuel. Enfin, dans une boucle, le
contexte change. . ne fera plus référence aux données disponibles dans la page
entière. Si vous avez besoin y d'accèder depuis l'intérieur d'une boucle, il est
judicieux d'y définir comme variable au lieu de dépendre du contexte.
**Exemple:**
```
{{ $title := .Site.Title }}
{{ range .Params.tags }}
<li> <a href="{{ $baseurl }}/tags/{{ . | urlize }}">
{{ . }}</a> - {{ $title }} </li>
{{ end }}
```
Notez que, une fois que nous sommes entrés dans la boucle, la valeur de
{{ . }} a changée. Nous avons défini une variable en dehors de la boucle, afin
d'y avoir accès dans la boucle.
# Les Paramètres d'Hugo
Hugo fournit l'option de passer des valeurs au modèle depuis la configuration du
site, ou depuis les métadonnées de chaque partie du contenu. Vous pouvez définir
n'importe quelle valeur de n'importe quel type (supporté par votre section
liminaire / format de configuration) et les utiliser comme vous le souhaitez
dans votre modèle.
## Utiliser les paramètres de contenu (page)
Dans chaque partie du contenu, vous pouvez fournir des variables pour être
utilisées par le modèle. Cela se passe dans la
[section liminaire](/content/front-matter).
Un exemple de cela est utilisé par ce site de documentation. La plupart des
pages bénéficient de la présentation de la table des matières. Quelques fois,
la table des matières n'a pas beaucoup de sens. Nous avons défini une variable
dans notre section liminaire de quelques pages pour désactiver la table des
matières.
Ceci est un exemple de section liminaire :
```
---
title: "Permalinks"
date: "2013-11-18"
aliases:
- "/doc/permalinks/"
groups: ["extras"]
groups_weight: 30
notoc: true
---
```
Ceci est le code correspondant dans le modèle :
{{ if not .Params.notoc }}
<div id="toc" class="well col-md-4 col-sm-6">
{{ .TableOfContents }}
</div>
{{ end }}
## Utiliser les paramètres de site (config)
Dans votre configuration de plus haut niveau (ex `config.yaml`), vous pouvez
définir des paramètres de site, dont les valeurs vous seront accessibles.
Pour les instances, vous pourriez délarer :
```yaml
params:
CopyrightHTML: "Copyright &#xA9; 2013 John Doe. All Rights Reserved."
TwitterUser: "spf13"
SidebarRecentLimit: 5
```
Avec un pied de page, vous devriez déclarer un `<footer>` qui est affiché
seulement si le paramètre `CopyrightHTML` est déclaré, et si il l'est, vous
devriez le déclarer comme HTML-safe, afin d'éviter d'échapper les entités HTML.
Cela vous permettra de le modifier facilement dans votre configuration au lieu
de le chercher dans votre modèle.
```
{{if .Site.Params.CopyrightHTML}}<footer>
<div class="text-center">{{.Site.Params.CopyrightHTML | safeHtml}}</div>
</footer>{{end}}
```
Une alternative au "if" et d'appeler la même valeur est d'utiliser "with". Cela
modifiera le contexte et passera le bloc si la variable est absente :
```
{{with .Site.Params.TwitterUser}}<span class="twitter">
<a href="https://twitter.com/{{.}}" rel="author">
<img src="/images/twitter.png" width="48" height="48" title="Twitter: {{.}}"
alt="Twitter"></a>
</span>{{end}}
```
Enfin, si vous souhaitez extraire des "constantes magiques" de vos mises en
page, vous pouvez le faire comme dans l'exemple suivant :
```
<nav class="recent">
<h1>Recent Posts</h1>
<ul>{{range first .Site.Params.SidebarRecentLimit .Site.Recent}}
<li><a href="{{.RelPermalink}}">{{.Title}}</a></li>
{{end}}</ul>
</nav>
```
[go]: <http://golang.org/>
[gohtmltemplate]: <http://golang.org/pkg/html/template/>

@ -0,0 +1,347 @@
+++
title = "(Hu)go Template Primer"
description = ""
type = ["posts","post"]
tags = [
"go",
"golang",
"templates",
"themes",
"development",
]
date = "2014-04-02"
categories = [
"Development",
"golang",
]
series = ["Hugo 101"]
[ author ]
name = "Hugo Authors"
+++
Hugo uses the excellent [Go][] [html/template][gohtmltemplate] library for
its template engine. It is an extremely lightweight engine that provides a very
small amount of logic. In our experience that it is just the right amount of
logic to be able to create a good static website. If you have used other
template systems from different languages or frameworks you will find a lot of
similarities in Go templates.
This document is a brief primer on using Go templates. The [Go docs][gohtmltemplate]
provide more details.
## Introduction to Go Templates
Go templates provide an extremely simple template language. It adheres to the
belief that only the most basic of logic belongs in the template or view layer.
One consequence of this simplicity is that Go templates parse very quickly.
A unique characteristic of Go templates is they are content aware. Variables and
content will be sanitized depending on the context of where they are used. More
details can be found in the [Go docs][gohtmltemplate].
## Basic Syntax
Golang templates are HTML files with the addition of variables and
functions.
**Go variables and functions are accessible within {{ }}**
Accessing a predefined variable "foo":
{{ foo }}
**Parameters are separated using spaces**
Calling the add function with input of 1, 2:
{{ add 1 2 }}
**Methods and fields are accessed via dot notation**
Accessing the Page Parameter "bar"
{{ .Params.bar }}
**Parentheses can be used to group items together**
{{ if or (isset .Params "alt") (isset .Params "caption") }} Caption {{ end }}
## Variables
Each Go template has a struct (object) made available to it. In hugo each
template is passed either a page or a node struct depending on which type of
page you are rendering. More details are available on the
[variables](/layout/variables) page.
A variable is accessed by referencing the variable name.
<title>{{ .Title }}</title>
Variables can also be defined and referenced.
{{ $address := "123 Main St."}}
{{ $address }}
## Functions
Go template ship with a few functions which provide basic functionality. The Go
template system also provides a mechanism for applications to extend the
available functions with their own. [Hugo template
functions](/layout/functions) provide some additional functionality we believe
are useful for building websites. Functions are called by using their name
followed by the required parameters separated by spaces. Template
functions cannot be added without recompiling hugo.
**Example:**
{{ add 1 2 }}
## Includes
When including another template you will pass to it the data it will be
able to access. To pass along the current context please remember to
include a trailing dot. The templates location will always be starting at
the /layout/ directory within Hugo.
**Example:**
{{ template "chrome/header.html" . }}
## Logic
Go templates provide the most basic iteration and conditional logic.
### Iteration
Just like in Go, the Go templates make heavy use of range to iterate over
a map, array or slice. The following are different examples of how to use
range.
**Example 1: Using Context**
{{ range array }}
{{ . }}
{{ end }}
**Example 2: Declaring value variable name**
{{range $element := array}}
{{ $element }}
{{ end }}
**Example 2: Declaring key and value variable name**
{{range $index, $element := array}}
{{ $index }}
{{ $element }}
{{ end }}
### Conditionals
If, else, with, or, & and provide the framework for handling conditional
logic in Go Templates. Like range, each statement is closed with `end`.
Go Templates treat the following values as false:
* false
* 0
* any array, slice, map, or string of length zero
**Example 1: If**
{{ if isset .Params "title" }}<h4>{{ index .Params "title" }}</h4>{{ end }}
**Example 2: If -> Else**
{{ if isset .Params "alt" }}
{{ index .Params "alt" }}
{{else}}
{{ index .Params "caption" }}
{{ end }}
**Example 3: And & Or**
{{ if and (or (isset .Params "title") (isset .Params "caption")) (isset .Params "attr")}}
**Example 4: With**
An alternative way of writing "if" and then referencing the same value
is to use "with" instead. With rebinds the context `.` within its scope,
and skips the block if the variable is absent.
The first example above could be simplified as:
{{ with .Params.title }}<h4>{{ . }}</h4>{{ end }}
**Example 5: If -> Else If**
{{ if isset .Params "alt" }}
{{ index .Params "alt" }}
{{ else if isset .Params "caption" }}
{{ index .Params "caption" }}
{{ end }}
## Pipes
One of the most powerful components of Go templates is the ability to
stack actions one after another. This is done by using pipes. Borrowed
from unix pipes, the concept is simple, each pipeline's output becomes the
input of the following pipe.
Because of the very simple syntax of Go templates, the pipe is essential
to being able to chain together function calls. One limitation of the
pipes is that they only can work with a single value and that value
becomes the last parameter of the next pipeline.
A few simple examples should help convey how to use the pipe.
**Example 1 :**
{{ if eq 1 1 }} Same {{ end }}
is the same as
{{ eq 1 1 | if }} Same {{ end }}
It does look odd to place the if at the end, but it does provide a good
illustration of how to use the pipes.
**Example 2 :**
{{ index .Params "disqus_url" | html }}
Access the page parameter called "disqus_url" and escape the HTML.
**Example 3 :**
{{ if or (or (isset .Params "title") (isset .Params "caption")) (isset .Params "attr")}}
Stuff Here
{{ end }}
Could be rewritten as
{{ isset .Params "caption" | or isset .Params "title" | or isset .Params "attr" | if }}
Stuff Here
{{ end }}
## Context (aka. the dot)
The most easily overlooked concept to understand about Go templates is that {{ . }}
always refers to the current context. In the top level of your template this
will be the data set made available to it. Inside of a iteration it will have
the value of the current item. When inside of a loop the context has changed. .
will no longer refer to the data available to the entire page. If you need to
access this from within the loop you will likely want to set it to a variable
instead of depending on the context.
**Example:**
{{ $title := .Site.Title }}
{{ range .Params.tags }}
<li> <a href="{{ $baseurl }}/tags/{{ . | urlize }}">{{ . }}</a> - {{ $title }} </li>
{{ end }}
Notice how once we have entered the loop the value of {{ . }} has changed. We
have defined a variable outside of the loop so we have access to it from within
the loop.
# Hugo Parameters
Hugo provides the option of passing values to the template language
through the site configuration (for sitewide values), or through the meta
data of each specific piece of content. You can define any values of any
type (supported by your front matter/config format) and use them however
you want to inside of your templates.
## Using Content (page) Parameters
In each piece of content you can provide variables to be used by the
templates. This happens in the [front matter](/content/front-matter).
An example of this is used in this documentation site. Most of the pages
benefit from having the table of contents provided. Sometimes the TOC just
doesn't make a lot of sense. We've defined a variable in our front matter
of some pages to turn off the TOC from being displayed.
Here is the example front matter:
```
---
title: "Permalinks"
date: "2013-11-18"
aliases:
- "/doc/permalinks/"
groups: ["extras"]
groups_weight: 30
notoc: true
---
```
Here is the corresponding code inside of the template:
{{ if not .Params.notoc }}
<div id="toc" class="well col-md-4 col-sm-6">
{{ .TableOfContents }}
</div>
{{ end }}
## Using Site (config) Parameters
In your top-level configuration file (eg, `config.yaml`) you can define site
parameters, which are values which will be available to you in chrome.
For instance, you might declare:
```yaml
params:
CopyrightHTML: "Copyright &#xA9; 2013 John Doe. All Rights Reserved."
TwitterUser: "spf13"
SidebarRecentLimit: 5
```
Within a footer layout, you might then declare a `<footer>` which is only
provided if the `CopyrightHTML` parameter is provided, and if it is given,
you would declare it to be HTML-safe, so that the HTML entity is not escaped
again. This would let you easily update just your top-level config file each
January 1st, instead of hunting through your templates.
```
{{if .Site.Params.CopyrightHTML}}<footer>
<div class="text-center">{{.Site.Params.CopyrightHTML | safeHtml}}</div>
</footer>{{end}}
```
An alternative way of writing the "if" and then referencing the same value
is to use "with" instead. With rebinds the context `.` within its scope,
and skips the block if the variable is absent:
```
{{with .Site.Params.TwitterUser}}<span class="twitter">
<a href="https://twitter.com/{{.}}" rel="author">
<img src="/images/twitter.png" width="48" height="48" title="Twitter: {{.}}"
alt="Twitter"></a>
</span>{{end}}
```
Finally, if you want to pull "magic constants" out of your layouts, you can do
so, such as in this example:
```
<nav class="recent">
<h1>Recent Posts</h1>
<ul>{{range first .Site.Params.SidebarRecentLimit .Site.Recent}}
<li><a href="{{.RelPermalink}}">{{.Title}}</a></li>
{{end}}</ul>
</nav>
```
[go]: https://golang.org/
[gohtmltemplate]: https://golang.org/pkg/html/template/

@ -0,0 +1,99 @@
+++
categories = ["Hugo"]
date = "2014-04-02"
description = ""
featured = "pic03.jpg"
featuredalt = "Pic 3"
featuredpath = "date"
linktitle = ""
slug = "Debuter avec Hugo"
title = "Débuter avec Hugo"
type = "post"
[ author ]
name = "Hugo Authors"
+++
## Étape 1. Installer Hugo
Allez sur la page de téléchargements de
[hugo](https://github.com/spf13/hugo/releases) et téléchargez la version
appropriée à votre système d'exploitation et votre architecture.
Sauvegardez le fichier téléchargé à un endroit précis, afin de l'utiliser dans
l'étape suivante.
Des informations plus complètes sont disponibles sur la page
[installing hugo](/overview/installing/)
<!--more-->
## Étape 2. Compilez la documentation
Hugo possède son propre site d'exemple qui se trouve être également le site que
vous lisez actuellement.
Suivez les instructions suivante :
1. Clonez le [dépôt de hugo](http://github.com/spf13/hugo)
2. Allez dans ce dépôt
3. Lancez Hugo en mode serveur et compilez la documentation
4. Ouvrez votre navigateur sur http://localhost:1313
Voici les commandes génériques correspondantes :
git clone https://github.com/spf13/hugo
cd hugo
/chemin/ou/vous/avez/installe/hugo server --source=./docs
> 29 pages created
> 0 tags index created
> in 27 ms
> Web Server is available at http://localhost:1313
> Press ctrl+c to stop
Lorsque vous avez cela, continuez le reste de ce guide sur votre version locale.
## Étape 3. Changer le site de documentation
Arrêtez le processus de Hugo en pressant ctrl+c.
Maintenant, nous allons relancer hugo, mais cette fois avec Hugo en mode de
surveillance.
/chemin/vers/hugo/de/l-etape/1/hugo server --source=./docs --watch
> 29 pages created
> 0 tags index created
> in 27 ms
> Web Server is available at http://localhost:1313
> Watching for changes in /Users/spf13/Code/hugo/docs/content
> Press ctrl+c to stop
Ouvrez votre [éditeur favori](https://vim.spf13.com) et changer l'une des
sources des pages de contenu.
Open your [favorite editor](http://vim.spf13.com) and change one of the source
content pages. Que diriez-vous de modifier ce fichier pour *résoudre une faute
de typo*.
Les fichiers de contenu peuvent être trouvés dans `docs/content/`. Sauf
indication contraire, les fichiers sont situés au même emplacement relatif que
l'URL, dans notre cas `docs/content/overview/quickstart.md`.
Modifiez et sauvegardez ce fichier. Notez ce qu'il se passe dans le terminal.
> Change detected, rebuilding site
> 29 pages created
> 0 tags index created
> in 26 ms
Rechargez la page dans votre navigateur et voyez que le problème de typo est
maintenant résolu.
Notez à quel point cela a été rapide. Essayez de recharger le site avant qu'il
soit fini de compiler.
Notice how quick that was. Try to refresh the site before it's finished
building. Je paris que vous n'y arrivez pas.
Le fait d'avoir des réactions presque instantanées vous permet d'avoir votre
créativité fluide sans avoir à attendre de longues compilations.
## Step 4. Amusez-vous
Le meilleur moyen d'apprendre quelque chose est de s'amuser avec.

@ -0,0 +1,92 @@
+++
title = "Getting Started with Hugo"
description = ""
type = ["posts","post"]
tags = [
"go",
"golang",
"hugo",
"development",
]
date = "2014-04-02"
categories = [
"Development",
"golang",
]
series = ["Hugo 101"]
[ author ]
name = "Hugo Authors"
+++
## Step 1. Install Hugo
Go to [Hugo releases](https://github.com/spf13/hugo/releases) and download the
appropriate version for your OS and architecture.
Save it somewhere specific as we will be using it in the next step.
More complete instructions are available at [Install Hugo](https://gohugo.io/getting-started/installing/)
## Step 2. Build the Docs
Hugo has its own example site which happens to also be the documentation site
you are reading right now.
Follow the following steps:
1. Clone the [Hugo repository](http://github.com/spf13/hugo)
2. Go into the repo
3. Run hugo in server mode and build the docs
4. Open your browser to http://localhost:1313
Corresponding pseudo commands:
git clone https://github.com/spf13/hugo
cd hugo
/path/to/where/you/installed/hugo server --source=./docs
> 29 pages created
> 0 tags index created
> in 27 ms
> Web Server is available at http://localhost:1313
> Press ctrl+c to stop
Once you've gotten here, follow along the rest of this page on your local build.
## Step 3. Change the docs site
Stop the Hugo process by hitting Ctrl+C.
Now we are going to run hugo again, but this time with hugo in watch mode.
/path/to/hugo/from/step/1/hugo server --source=./docs --watch
> 29 pages created
> 0 tags index created
> in 27 ms
> Web Server is available at http://localhost:1313
> Watching for changes in /Users/spf13/Code/hugo/docs/content
> Press ctrl+c to stop
Open your [favorite editor](http://vim.spf13.com) and change one of the source
content pages. How about changing this very file to *fix the typo*. How about changing this very file to *fix the typo*.
Content files are found in `docs/content/`. Unless otherwise specified, files
are located at the same relative location as the url, in our case
`docs/content/overview/quickstart.md`.
Change and save this file.. Notice what happened in your terminal.
> Change detected, rebuilding site
> 29 pages created
> 0 tags index created
> in 26 ms
Refresh the browser and observe that the typo is now fixed.
Notice how quick that was. Try to refresh the site before it's finished building. I double dare you.
Having nearly instant feedback enables you to have your creativity flow without waiting for long builds.
## Step 4. Have fun
The best way to learn something is to play with it.

@ -0,0 +1,218 @@
+++
categories = ["Hugo", "Jekyll"]
date = "2014-03-10"
description = ""
featured = ""
featuredalt = ""
featuredpath = ""
linktitle = ""
slug = "Migrer vers Hugo depuis Jekyll"
title = "Migrer vers Hugo depuis Jekyll"
type = ["posts","post"]
[ author ]
name = "Hugo Authors"
+++
## Déplacez le contenu statique vers `static`
Jekyll a une règle comme quoi tout répertoire qui ne commence pas par `_` sera
copié tel-quel dans le répertoire `_site`. Hugo garde tout le contenu statique
dans le répertoire `static`. Vous devez donc déplacer tout ce type de contenu
là-dedans. Avec Jekylll, l'arborescence ressemblant à ceci :
<root>/
▾ images/
logo.png
<!--more-->
doit devenir
<root>/
▾ static/
▾ images/
logo.png
En outre, vous allez devoir déplacer tous les fichiers présents à la racine vers
le répertoire `static`.
## Créez votre configuration Hugo
Hugo peut lire votre fichier de configuration au format JSON, YAML et TOML. Hugo
supporte également les paramètres de configuration. Plus d'informations sur la
[documentation de configuration Hugo](/overview/configuration/)
## Définiez votre répertoire de publication sur `_site`
La valeur par défaut pour Jekyll est d'utiliser le répertoire `_site` pour
publier le contenu. Pour Hugo, le répertoire de publication est `public`. Si,
comme moi, vous avez [lié `_site` vers un sous-module git sur la branche
`gh-pages`](http://blog.blindgaenger.net/generate_github_pages_in_a_submodule.ht
ml), vous allez vouloir avoir quelques alternatives :
1. Changez votre lien du sous-module `gh-pages` pour pointer sur public au lieu
de `_site` (recommendé).
git submodule deinit _site
git rm _site
git submodule add -b gh-pages
git@github.com:your-username/your-repo.git public
2. Ou modifiez la configuration de Hugo pour utiliser le répertoire `_site` au
lieu de `public`.
{
..
"publishdir": "_site",
..
}
## Convertir un thème Jekyll pour Hugo
C'est la majeure partie du travail. La documentation est votre ami.
Vous devriez vous référer à [la documentation des thèmes de Jekyll]
(http://jekyllrb.com/docs/templates/) si vous devez vous rafraîchir la mémoire
sur la façon dont vous avez construit votre blog et [les thèmes de Hugo]
(/layout/templates/) pour apprendre la manière de faire sur Hugo.
Pour vous donner un point de référence, la conversion du thème pour
[heyitsalex.net](http://heyitsalex.net/) ne m'a pris que quelques heures.
## Convertir les extensions Jekyll vers des shortcodes Hugo
Jekyll support les [extensions](http://jekyllrb.com/docs/plugins/); Hugo lui a
les [shortcodes](/doc/shortcodes/). C'est assez banal les porter.
### Implémentation
Comme exemple, j'utilise une extension pour avoir un [`image_tag`](https://githu
b.com/alexandre-normand/alexandre-normand/blob/74bb12036a71334fdb7dba84e073382fc
06908ec/_plugins/image_tag.rb) presonnalisé pour générer les images avec une
légende sur Jekyll. J'ai vu que Hugo implémente un shortcode qui fait exactement
la même chose.
Extension Jekyll :
```
module Jekyll
class ImageTag < Liquid::Tag
@url = nil
@caption = nil
@class = nil
@link = nil
// Patterns
IMAGE_URL_WITH_CLASS_AND_CAPTION =
IMAGE_URL_WITH_CLASS_AND_CAPTION_AND_LINK =
/(\w+)(\s+)((https?:\/\/|\/)(\S+))(\s+)"(.*?)"(\s+)->
((https?:\/\/|\/)(\S+))(\s*)/i
IMAGE_URL_WITH_CAPTION = /((https?:\/\/|\/)(\S+))(\s+)"(.*?)"/i
IMAGE_URL_WITH_CLASS = /(\w+)(\s+)((https?:\/\/|\/)(\S+))/i
IMAGE_URL = /((https?:\/\/|\/)(\S+))/i
def initialize(tag_name, markup, tokens)
super
if markup =~ IMAGE_URL_WITH_CLASS_AND_CAPTION_AND_LINK
@class = $1
@url = $3
@caption = $7
@link = $9
elsif markup =~ IMAGE_URL_WITH_CLASS_AND_CAPTION
@class = $1
@url = $3
@caption = $7
elsif markup =~ IMAGE_URL_WITH_CAPTION
@url = $1
@caption = $5
elsif markup =~ IMAGE_URL_WITH_CLASS
@class = $1
@url = $3
elsif markup =~ IMAGE_URL
@url = $1
end
end
def render(context)
if @class
source = "<figure class='#{@class}'>"
else
source = "<figure>"
end
if @link
source += "<a href=\"#{@link}\">"
end
source += "<img src=\"#{@url}\">"
if @link
source += "</a>"
end
source += "<figcaption>#{@caption}</figcaption>" if @caption
source += "</figure>"
source
end
end
end
Liquid::Template.register_tag('image', Jekyll::ImageTag)
```
Écrite en tant que shortcode Hugo:
```
<!-- image -->
<figure {{ with .Get "class" }}class="{{.}}"{{ end }}>
{{ with .Get "link"}}<a href="{{.}}">{{ end }}
<img src="{{ .Get "src" }}"
{{ if or (.Get "alt") (.Get "caption") }}
alt="{{ with .Get "alt"}}
{{.}}
{{else}}
{{ .Get "caption" }}
{{ end }}"
{{ end }} />
{{ if .Get "link"}}</a>{{ end }}
{{ if or (or (.Get "title") (.Get "caption")) (.Get "attr")}}
<figcaption>{{ if isset .Params "title" }}
{{ .Get "title" }}{{ end }}
{{ if or (.Get "caption") (.Get "attr")}}<p>
{{ .Get "caption" }}
{{ with .Get "attrlink"}}<a href="{{.}}"> {{ end }}
{{ .Get "attr" }}
{{ if .Get "attrlink"}}</a> {{ end }}
</p> {{ end }}
</figcaption>
{{ end }}
</figure>
<!-- image -->
```
### Utilisation
J'ai simplement changé :
```
{% image
full http://farm5.staticflickr.com/4136/4829260124_57712e570a_o_d.jpg
"One of my favorite touristy-type photos. I secretly waited for the
good light while we were "having fun" and took this. Only regret: a
stupid pole in the top-left corner of the frame I had to clumsily get
rid of at post-processing."
->http://www.flickr.com/photos/alexnormand/4829260124/in/
set-72157624547713078/ %}
```
pour cela (cet exemple utilise une version légèrement étendue nommée `fig`,
différente de la `figure` intégrée) :
```
{{%/* fig class="full"
src="http://farm5.staticflickr.com/4136/4829260124_57712e570a_o_d.jpg"
title="One of my favorite touristy-type photos. I secretly waited for the
good light while we were having fun and took this. Only regret: a stupid
pole in the top-left corner of the frame I had to clumsily get rid of at
post-processing."
link="http://www.flickr.com/photos/alexnormand/4829260124/in/
set-72157624547713078/" */%}}
```
Comme bonus, les paramètres nommés des shortcodes sont plus lisibles.
## Touches finales
### Corriger le contenu
Suivant le nombre de modifications que vous avez effectué sur chaque articles
avec Jekyll, cette étape requierra plus ou moins d'efforts. Il n'y a pas de
règles rigoureuses ici, si ce n'est que `hugo server --watch` est votre ami.
Testez vos modifications et corrigez les erreurs au besoin.
### Nettoyez le tout
Vous voudrez sûrement supprimer votre configuration Jekyll maintenant que tout
est fini. Exact, pensez à supprimer tout ce qui est inutilisé.
## Un exemple pratique
[Hey, it's Alex](http://heyitsalex.net/) a été migré de Jekyll vers Hugo en
moins de temps qu'une journée père enfant. Vous pouvez trouver toutes les
modification en regardant ce [diff](https://github.com/alexandre-normand/alexand
re-normand/compare/869d69435bd2665c3fbf5b5c78d4c22759d7613a...b7f6605b1265e83b4b
81495423294208cc74d610).

@ -0,0 +1,161 @@
---
author:
name: "Hugo Authors"
date: 2014-03-10
linktitle: Migrating from Jekyll
title: Migrate to Hugo from Jekyll
type:
- post
- posts
weight: 10
series:
- Hugo 101
aliases:
- /blog/migrate-from-jekyll/
---
## Move static content to `static`
Jekyll has a rule that any directory not starting with `_` will be copied as-is to the `_site` output. Hugo keeps all static content under `static`. You should therefore move it all there.
With Jekyll, something that looked like
<root>/
▾ images/
logo.png
should become
<root>/
▾ static/
▾ images/
logo.png
Additionally, you'll want any files that should reside at the root (such as `CNAME`) to be moved to `static`.
## Create your Hugo configuration file
Hugo can read your configuration as JSON, YAML or TOML. Hugo supports parameters custom configuration too. Refer to the [Hugo configuration documentation](/overview/configuration/) for details.
## Set your configuration publish folder to `_site`
The default is for Jekyll to publish to `_site` and for Hugo to publish to `public`. If, like me, you have [`_site` mapped to a git submodule on the `gh-pages` branch](http://blog.blindgaenger.net/generate_github_pages_in_a_submodule.html), you'll want to do one of two alternatives:
1. Change your submodule to point to map `gh-pages` to public instead of `_site` (recommended).
git submodule deinit _site
git rm _site
git submodule add -b gh-pages git@github.com:your-username/your-repo.git public
2. Or, change the Hugo configuration to use `_site` instead of `public`.
{
..
"publishdir": "_site",
..
}
## Convert Jekyll templates to Hugo templates
That's the bulk of the work right here. The documentation is your friend. You should refer to [Jekyll's template documentation](http://jekyllrb.com/docs/templates/) if you need to refresh your memory on how you built your blog and [Hugo's template](/layout/templates/) to learn Hugo's way.
As a single reference data point, converting my templates for [heyitsalex.net](http://heyitsalex.net/) took me no more than a few hours.
## Convert Jekyll plugins to Hugo shortcodes
Jekyll has [plugins](http://jekyllrb.com/docs/plugins/); Hugo has [shortcodes](/doc/shortcodes/). It's fairly trivial to do a port.
### Implementation
As an example, I was using a custom [`image_tag`](https://github.com/alexandre-normand/alexandre-normand/blob/74bb12036a71334fdb7dba84e073382fc06908ec/_plugins/image_tag.rb) plugin to generate figures with caption when running Jekyll. As I read about shortcodes, I found Hugo had a nice built-in shortcode that does exactly the same thing.
Jekyll's plugin:
module Jekyll
class ImageTag < Liquid::Tag
@url = nil
@caption = nil
@class = nil
@link = nil
// Patterns
IMAGE_URL_WITH_CLASS_AND_CAPTION =
IMAGE_URL_WITH_CLASS_AND_CAPTION_AND_LINK = /(\w+)(\s+)((https?:\/\/|\/)(\S+))(\s+)"(.*?)"(\s+)->((https?:\/\/|\/)(\S+))(\s*)/i
IMAGE_URL_WITH_CAPTION = /((https?:\/\/|\/)(\S+))(\s+)"(.*?)"/i
IMAGE_URL_WITH_CLASS = /(\w+)(\s+)((https?:\/\/|\/)(\S+))/i
IMAGE_URL = /((https?:\/\/|\/)(\S+))/i
def initialize(tag_name, markup, tokens)
super
if markup =~ IMAGE_URL_WITH_CLASS_AND_CAPTION_AND_LINK
@class = $1
@url = $3
@caption = $7
@link = $9
elsif markup =~ IMAGE_URL_WITH_CLASS_AND_CAPTION
@class = $1
@url = $3
@caption = $7
elsif markup =~ IMAGE_URL_WITH_CAPTION
@url = $1
@caption = $5
elsif markup =~ IMAGE_URL_WITH_CLASS
@class = $1
@url = $3
elsif markup =~ IMAGE_URL
@url = $1
end
end
def render(context)
if @class
source = "<figure class='#{@class}'>"
else
source = "<figure>"
end
if @link
source += "<a href=\"#{@link}\">"
end
source += "<img src=\"#{@url}\">"
if @link
source += "</a>"
end
source += "<figcaption>#{@caption}</figcaption>" if @caption
source += "</figure>"
source
end
end
end
Liquid::Template.register_tag('image', Jekyll::ImageTag)
is written as this Hugo shortcode:
<!-- image -->
<figure {{ with .Get "class" }}class="{{.}}"{{ end }}>
{{ with .Get "link"}}<a href="{{.}}">{{ end }}
<img src="{{ .Get "src" }}" {{ if or (.Get "alt") (.Get "caption") }}alt="{{ with .Get "alt"}}{{.}}{{else}}{{ .Get "caption" }}{{ end }}"{{ end }} />
{{ if .Get "link"}}</a>{{ end }}
{{ if or (or (.Get "title") (.Get "caption")) (.Get "attr")}}
<figcaption>{{ if isset .Params "title" }}
{{ .Get "title" }}{{ end }}
{{ if or (.Get "caption") (.Get "attr")}}<p>
{{ .Get "caption" }}
{{ with .Get "attrlink"}}<a href="{{.}}"> {{ end }}
{{ .Get "attr" }}
{{ if .Get "attrlink"}}</a> {{ end }}
</p> {{ end }}
</figcaption>
{{ end }}
</figure>
<!-- image -->
### Usage
I simply changed:
{% image full http://farm5.staticflickr.com/4136/4829260124_57712e570a_o_d.jpg "One of my favorite touristy-type photos. I secretly waited for the good light while we were "having fun" and took this. Only regret: a stupid pole in the top-left corner of the frame I had to clumsily get rid of at post-processing." ->http://www.flickr.com/photos/alexnormand/4829260124/in/set-72157624547713078/ %}
to this (this example uses a slightly extended version named `fig`, different than the built-in `figure`):
{{%/* fig class="full" src="http://farm5.staticflickr.com/4136/4829260124_57712e570a_o_d.jpg" title="One of my favorite touristy-type photos. I secretly waited for the good light while we were having fun and took this. Only regret: a stupid pole in the top-left corner of the frame I had to clumsily get rid of at post-processing." link="http://www.flickr.com/photos/alexnormand/4829260124/in/set-72157624547713078/" */%}}
As a bonus, the shortcode named parameters are, arguably, more readable.
## Finishing touches
### Fix content
Depending on the amount of customization that was done with each post with Jekyll, this step will require more or less effort. There are no hard and fast rules here except that `hugo server --watch` is your friend. Test your changes and fix errors as needed.
### Clean up
You'll want to remove the Jekyll configuration at this point. If you have anything else that isn't used, delete it.
## A practical example in a diff
[Hey, it's Alex](http://heyitsalex.net/) was migrated in less than a _father-with-kids day_ from Jekyll to Hugo. You can see all the changes (and screw-ups) by looking at this [diff](https://github.com/alexandre-normand/alexandre-normand/compare/869d69435bd2665c3fbf5b5c78d4c22759d7613a...b7f6605b1265e83b4b81495423294208cc74d610).

@ -0,0 +1 @@
{"Target":"main.154a87e0ff720e102948892a8eb80881aa81a4faf37376f3093be219f6296c3d.css","MediaType":"text/css","Data":{"Integrity":"sha256-FUqH4P9yDhApSIkqjrgIgaqBpPrzc3bzCTviGfYpbD0="}}

@ -0,0 +1,39 @@
# Translations for German
# https://gohugo.io/content-management/multilingual/#translation-of-strings
# Generic
#
[translations]
other = "Übersetzungen"
[postAvailable]
other = "Auch verfügbar auf"
# 404.html
#
[archives]
other = "Archiv"
[home]
other = "Home"
[notFound]
other = "Oops, Seite nicht gefunden ..."
# posts/single.html
#
[readingTime]
one = "Eine Minute"
other = "{{ .Count }} Minuten"
[tableOfContents]
other = "Inhaltsverzeichnis"
[wordCount]
one = "Ein Wort"
other = "{{ .Count }} Wörter"
[lastModified]
other = "Letzte Aktualisierung"

@ -0,0 +1,39 @@
# Translations for English
# https://gohugo.io/content-management/multilingual/#translation-of-strings
# Generic
#
[translations]
other = "Translations"
[postAvailable]
other = "Also available in"
# 404.html
#
[archives]
other = "Archives"
[home]
other = "Home"
[notFound]
other = "Oops, page not found…"
# posts/single.html
#
[readingTime]
one = "One minute"
other = "{{ .Count }} minutes"
[tableOfContents]
other = "Table of Contents"
[wordCount]
one = "One Word"
other = "{{ .Count }} Words"
[lastModified]
other = "Last updated"

@ -0,0 +1,39 @@
# Translations for Spanish
# https://gohugo.io/content-management/multilingual/#translation-of-strings
# Generic
#
[translations]
other = "Traducciones"
[postAvailable]
other = "También disponible en"
# 404.html
#
[archives]
other = "Archivo"
[home]
other = "Home"
[notFound]
other = "Oops, página no encontrada…"
# posts/single.html
#
[readingTime]
one = "Un minuto"
other = "{{ .Count }} minutos"
[tableOfContents]
other = "Tabla de Contenido"
[wordCount]
one = "Una Palabra"
other = "{{ .Count }} Palabras"
[lastModified]
other = "Ultima actualización"

@ -0,0 +1,39 @@
# Translations for French
# https://gohugo.io/content-management/multilingual/#translation-of-strings
# Generic
#
[translations]
other = "Traductions"
[postAvailable]
other = "Aussi disponible en"
# 404.html
#
[archives]
other = "Les archives"
[home]
other = "Accueil"
[notFound]
other = "Oups, page non trouvée …"
# posts/single.html
#
[readingTime]
one = "Une minute"
other = "{{ .Count }} minutes"
[tableOfContents]
other = "Table des matières"
[wordCount]
one = "Un Mot"
other = "{{ .Count }} Mots"
[lastModified]
other = "Mise à jour"

@ -0,0 +1,36 @@
# Translations for Galician
# https://gohugo.io/content-management/multilingual/#translation-of-strings
# Generic
#
[translations]
other = "Traducións"
[postAvailable]
other = "Tamén dispoñible en"
# 404.html
#
[archives]
other = "Arquivos"
[home]
other = "Inicio"
[notFound]
other = "Vaia, non se atopou a páxina..."
# posts/single.html
#
[readingTime]
one = "Un minuto"
other = "{{ .Count }} minutos"
[tableOfContents]
other = "Táboa de contidos"
[wordCount]
one = "Unha Palabra"
other = "{{ .Count }} Palabras"

@ -0,0 +1,39 @@
# Translations for Hindi
# https://gohugo.io/content-management/multilingual/#translation-of-strings
# Generic
#
[translations]
other = "अनुवाद"
[postAvailable]
other = "पढ़ें इस भाषा में"
# 404.html
#
[archives]
other = "पुरालेख"
[home]
other = "घर"
[notFound]
other = "क्षमा करें ! पेज़ नहीं मिला…"
# posts/single.html
#
[readingTime]
one = "एक मिनट"
other = "{{ .Count }} मिनट"
[tableOfContents]
other = "अनुक्रमणिका"
[wordCount]
one = "एक शब्द"
other = "{{ .Count }} शब्द"
[lastModified]
other = "आखरी अपडेट"

@ -0,0 +1,39 @@
# Translations for Indonesia
# https://gohugo.io/content-management/multilingual/#translation-of-strings
# Generic
#
[translations]
other = "Terjemahan"
[postAvailable]
other = "Tersedia juga di"
# 404.html
#
[archives]
other = "Arsip"
[home]
other = "Beranda"
[notFound]
other = "Oops, halaman tidak ditemukan…"
# posts/single.html
#
[readingTime]
one = "Satu menit"
other = "{{ .Count }} menit"
[tableOfContents]
other = "Daftar isi"
[wordCount]
one = "Satu Kata"
other = "{{ .Count }} Kata"
[lastModified]
other = "Terakhir diupdate"

@ -0,0 +1,39 @@
# Translations for English
# https://gohugo.io/content-management/multilingual/#translation-of-strings
# Generic
#
[translations]
other = "Traduzioni"
[postAvailable]
other = "Disponibile anche in"
# 404.html
#
[archives]
other = "Archivi"
[home]
other = "Home"
[notFound]
other = "Oops, pagina non trovata…"
# posts/single.html
#
[readingTime]
one = "Un minuto"
other = "{{ .Count }} minuti"
[tableOfContents]
other = "Contenuti"
[wordCount]
one = "Una parola"
other = "{{ .Count }} parole"
[lastModified]
other = "Ultimo aggiornamento"

@ -0,0 +1,39 @@
# Translations for Japanese
# https://gohugo.io/content-management/multilingual/#translation-of-strings
# Generic
#
[translations]
other = "翻訳"
[postAvailable]
other = "他の言語"
# 404.html
#
[archives]
other = "アーカイブ"
[home]
other = "ホームページ"
[notFound]
other = "あっ、ページが見つかりません……"
# Please add hasCJKLanguage = true under [languages.ja] for the below to behave correctly
# posts/single.html
#
[readingTime]
one = "一分"
other = "{{ .Count }}分"
[tableOfContents]
other = "目次"
[wordCount]
one = "一文字"
other = "{{ .Count }}文字"
[lastModified]
other = "最終更新"

@ -0,0 +1,39 @@
# Translations for English
# https://gohugo.io/content-management/multilingual/#translation-of-strings
# Generic
#
[translations]
other = "Traduzion"
[postAvailable]
other = "Disponibel anca in"
# 404.html
#
[archives]
other = "Archivi"
[home]
other = "Home"
[notFound]
other = "Oops, pagina minga trovada…"
# posts/single.html
#
[readingTime]
one = "On megnuu"
other = "{{ .Count }} megnuu"
[tableOfContents]
other = "Contegnuu"
[wordCount]
one = "Ona parolla"
other = "{{ .Count }} paroll"
[lastModified]
other = "Last update"

@ -0,0 +1,39 @@
# Translations for മലയാളം [Malayalam]
# https://gohugo.io/content-management/multilingual/#translation-of-strings
# Generic
#
[translations]
other = "വിവർത്തനങ്ങൾ"
[postAvailable]
other = "ഈ പോസ്റ്റ് ലഭ്യമായ മറ്റ് ഭാഷകൾ:"
# 404.html
#
[archives]
other = "ശേഖരം"
[home]
other = "പ്രധാന താൾ"
[notFound]
other = "ക്ഷമിക്കണം. താൾ ലഭ്യമല്ല. ദേയവയി വിലാസം പരിശോധിക്കുക അല്ലെങ്കിൽ അൽപ സമയത്തിനു ശേഷം വീണ്ടും പരിശ്രമിക്കുക."
# posts/single.html
#
[readingTime]
one = "ഒരു മിനിറ്റ്"
other = "{{ .Count }} മിനിറ്റുകൾ"
[tableOfContents]
other = "ഉള്ളടക്ക പട്ടിക"
[wordCount]
one = "ഒരു വാക്ക്"
other = "{{ .Count }} വാക്കുകൾ"
[lastModified]
other = "അവസാനമായി പുതുക്കിയത്"

@ -0,0 +1,39 @@
# Translations for Portuguese
# https://gohugo.io/content-management/multilingual/#translation-of-strings
# Generic
#
[translations]
other = "Traduções"
[postAvailable]
other = "Também disponível em"
# 404.html
#
[archives]
other = "Arquivo"
[home]
other = "Início"
[notFound]
other = "Oops, página não encontrada…"
# posts/single.html
#
[readingTime]
one = "Um minuto"
other = "{{ .Count }} minutos"
[tableOfContents]
other = "Índice"
[wordCount]
one = "Uma Palavra"
other = "{{ .Count }} Palavras"
[lastModified]
other = "Última actualização"

@ -0,0 +1,39 @@
# Translations for Romanian
# https://gohugo.io/content-management/multilingual/#translation-of-strings
# Generic
#
[translations]
other = "Traduceri"
[postAvailable]
other = "Disponibil și în"
# 404.html
#
[archives]
other = "Arhive"
[home]
other = "Acasă"
[notFound]
other = "Ups, pagina nu a fost găsită…"
# posts/single.html
#
[readingTime]
one = "Un minut"
other = "{{ .Count }} de minute"
[tableOfContents]
other = "Cuprins"
[wordCount]
one = "Un cuvânt"
other = "{{ .Count }} de cuvinte"
[lastModified]
other = "Ultima modificare"

@ -0,0 +1,43 @@
# Translations for Russian
# https://gohugo.io/content-management/multilingual/#translation-of-strings
# Generic
#
[translations]
other = "Переводы"
[postAvailable]
other = "Доступно на "
# 404.html
#
[archives]
other = "Архивы"
[home]
other = "Главная"
[notFound]
other = "Упс, страница не найдена…"
# posts/single.html
#
[readingTime]
one = "{{ .Count }} минута"
few = "{{ .Count }} минуты"
many = "{{ .Count }} минут"
other = "{{ .Count }} минут"
[tableOfContents]
other = "Содержимое"
[wordCount]
one = "{{ .Count }} слово"
few = "{{ .Count }} слова"
many = "{{ .Count }} слов"
other = "{{ .Count }} слов"
[lastModified]
other = "Последнее обновление"

@ -0,0 +1,39 @@
# Translations for English
# https://gohugo.io/content-management/multilingual/#translation-of-strings
# Generic
#
[translations]
other = "Çeviriler"
[postAvailable]
other = "Ayrıca"
# 404.html
#
[archives]
other = "Arşiv"
[home]
other = "Ana Sayfa"
[notFound]
other = "Sayfa bulunamadı…"
# posts/single.html
#
[readingTime]
one = "Bir dakika"
other = "{{ .Count }} dakika"
[tableOfContents]
other = "İçindekiler"
[wordCount]
one = "One Kelime"
other = "{{ .Count }} Kelime"
[lastModified]
other = "Son güncelleme"

@ -0,0 +1,43 @@
# Translations for Ukrainian
# https://gohugo.io/content-management/multilingual/#translation-of-strings
# Generic
#
[translations]
other = "Переклади"
[postAvailable]
other = "Доступне на "
# 404.html
#
[archives]
other = "Архіви"
[home]
other = "Головна"
[notFound]
other = "Упс, сторінка не знайдена…"
# posts/single.html
#
[readingTime]
one = "{{ .Count }} хвилина"
few = "{{ .Count }} хвилини"
many = "{{ .Count }} хвилин"
other = "{{ .Count }} хвилин"
[tableOfContents]
other = "Вміст"
[wordCount]
one = "{{ .Count }} слово"
few = "{{ .Count }} слова"
many = "{{ .Count }} слів"
other = "{{ .Count }} слів"
[lastModified]
other = "Останнє оновлення"

@ -0,0 +1,39 @@
# Translations for Chinese (China)
# https://gohugo.io/content-management/multilingual/#translation-of-strings
# Generic
#
[translations]
other = "译文"
[postAvailable]
other = "其他语言"
# 404.html
#
[archives]
other = "档案"
[home]
other = "主页"
[notFound]
other = "噢,找不到页面……"
# Please add hasCJKLanguage = true under [languages.zh-cn] for the below to behave correctly
# posts/single.html
#
[readingTime]
one = "一分钟"
other = "{{ .Count }}分钟"
[tableOfContents]
other = "目录"
[wordCount]
one = "一字"
other = "{{ .Count }}字"
[lastModified]
other = "最后修改"

@ -0,0 +1,39 @@
# Translations for Chinese (Hong Kong) [Cantonese]
# https://gohugo.io/content-management/multilingual/#translation-of-strings
# Generic
#
[translations]
other = "譯文"
[postAvailable]
other = "其他語言"
# 404.html
#
[archives]
other = "貼文"
[home]
other = "主頁"
[notFound]
other = "哎呀,揾唔到添……"
# Please add hasCJKLanguage = true under [languages.zh-hk] for the below to behave correctly
# posts/single.html
#
[readingTime]
one = "一分鐘"
other = "{{ .Count }}分鐘"
[tableOfContents]
other = "目錄"
[wordCount]
one = "一粒字"
other = "{{ .Count }}字"
[lastModified]
other = "最後修改"

@ -0,0 +1,39 @@
# Translations for Chinese (Taiwan)
# https://gohugo.io/content-management/multilingual/#translation-of-strings
# Generic
#
[translations]
other = "譯文"
[postAvailable]
other = "其他語言"
# 404.html
#
[archives]
other = "檔案"
[home]
other = "主頁"
[notFound]
other = "噢,找不到頁面……"
# Please add hasCJKLanguage = true under [languages.zh-tw] for the below to behave correctly
# posts/single.html
#
[readingTime]
one = "一分鐘"
other = "{{ .Count }}分鐘"
[tableOfContents]
other = "目錄"
[wordCount]
one = "一字"
other = "{{ .Count }}字"
[lastModified]
other = "最後修改"

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

@ -0,0 +1,21 @@
{{ define "main" }}
<div id="spotlight" class="error-404 animated fadeIn">
<p class="img-404">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-cloud-drizzle"><line x1="8" y1="19" x2="8" y2="21"></line><line x1="8" y1="13" x2="8" y2="15"></line><line x1="16" y1="19" x2="16" y2="21"></line><line x1="16" y1="13" x2="16" y2="15"></line><line x1="12" y1="21" x2="12" y2="23"></line><line x1="12" y1="15" x2="12" y2="17"></line><path d="M20 16.58A5 5 0 0 0 18 7h-1.26A8 8 0 1 0 4 15.25"></path></svg>
</p>
<div class="banner-404">
<h1>404</h1>
<p>{{ i18n "notFound" }}</p>
<p class="btn-404">
<a href="{{.Site.BaseURL}}">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-home"><path d="M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"></path><polyline points="9 22 9 12 15 12 15 22"></polyline></svg>
{{- i18n "home" -}}
</a>
<a href="{{ "posts" | absLangURL }}">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-archive"><polyline points="21 8 21 21 3 21 3 8"></polyline><rect x="1" y="3" width="22" height="5"></rect><line x1="10" y1="12" x2="14" y2="12"></line></svg>
{{- i18n "archives" -}}
</a>
</p>
</div>
</div>
{{ end }}

@ -0,0 +1,25 @@
<!DOCTYPE html>
<html lang="{{ .Site.Language }}">
<head>
{{ partial "head.html" . }}
</head>
{{ block "body" . }}
<body>
{{ end }}
<div class="container">
{{ partial "header.html" . }}
<div class="content">
{{ block "main" . }}{{ end }}
</div>
{{ block "footer" . }}
{{ partial "footer.html" . }}
{{ end }}
</div>
{{ partial "javascript.html" . }}
</body>
</html>

@ -0,0 +1,35 @@
{{ define "main" }}
{{ $paginator := .Paginate .Data.Pages }}
<main class="posts">
<h1>{{ .Title }}</h1>
{{ if .Content }}
<div class="content">{{ .Content }}</div>
{{ end }}
{{ range $paginator.Pages.GroupByDate "2006" }}
<div class="posts-group">
<div class="post-year">{{ .Key }}</div>
<ul class="posts-list">
{{ range .Pages }}
<li class="post-item">
<a href="{{.Permalink}}" class="post-item-inner">
<span class="post-title">{{.Title}}</span>
<span class="post-day">
{{ if .Site.Params.dateformShort }}
{{ .Date.Format .Site.Params.dateformShort }}
{{ else }}
{{ .Date.Format "Jan 2"}}
{{ end }}
</span>
</a>
</li>
{{ end }}
</ul>
</div>
{{ end }}
{{ partial "pagination-list.html" . }}
</main>
{{ end }}

@ -0,0 +1,52 @@
{{ define "main" }}
<main class="post">
<div class="post-info">
{{ if .IsTranslated }}
{{ i18n "postAvailable" }}
{{ range .Translations }}
<a href="{{ .Permalink }}"><span class="flag fi fi-{{ index $.Site.Data.langFlags (.Lang) }}"></span></a>
{{ end}}
{{ end }}
</p>
</div>
<article>
<h2 class="post-title"><a href="{{ .Permalink }}">{{ .Title | markdownify }}</a></h2>
{{ if .Params.Cover }}
<figure class="post-cover">
<img src="{{ .Params.Cover | absURL }}" alt="{{ .Title }}" />
{{ if .Params.CoverCaption }}
<figcaption class="center">{{ .Params.CoverCaption | markdownify }}</figcaption>
{{ end }}
</figure>
{{ end }}
{{ if .Params.toc }}
<hr />
<aside id="toc">
<div class="toc-title">{{ i18n "tableOfContents" }}</div>
{{ .TableOfContents }}
</aside>
<hr />
{{ end }}
<div class="post-content">
{{ .Content }}
</div>
</article>
<hr />
<div class="post-info">
{{ partial "tags.html" .Params.tags }}
{{ partial "categories.html" . }}
{{- if .GitInfo }}
<p><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-git-commit"><circle cx="12" cy="12" r="4"></circle><line x1="1.05" y1="12" x2="7" y2="12"></line><line x1="17.01" y1="12" x2="22.96" y2="12"></line></svg><a href="{{ .Site.Params.gitUrl -}}{{ .GitInfo.Hash }}" target="_blank" rel="noopener">{{ .GitInfo.AbbreviatedHash }}</a> @ {{ if .Site.Params.dateformNum }}{{ dateFormat .Site.Params.dateformNum .GitInfo.AuthorDate.Local }}{{ else }}{{ dateFormat "2006-01-02" .GitInfo.AuthorDate.Local }}{{ end }}</p>
{{- end }}
</div>
</main>
{{ end }}

@ -0,0 +1,23 @@
{{ define "body" }}
<body class="{{ if .Site.Params.backgroundImage }} background-image" style="background-image: url('{{ .Site.Params.backgroundImage }}');" {{ else }}"{{ end }}>
{{ end }}
{{ define "main" }}
<main aria-role="main">
<div>
{{ if .Site.Params.Portrait.Path }}
<img src="{{ .Site.Params.Portrait.Path }}" class="circle" alt="{{ .Site.Params.Portrait.Alt }}" style="max-width:{{ .Site.Params.Portrait.MaxWidth }}" />
{{ end }}
<h1>{{ .Site.Title }}</h1>
{{ partial "subtitle.html" . }}
{{- with .Site.Params.social }}
<div>
{{ partial "social-icons.html" . }}
</div>
{{- end }}
</div>
</main>
{{ end }}

@ -0,0 +1,9 @@
{{ with .Params.categories }}
<p>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-folder meta-icon"><path d="M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"></path></svg>
{{ range . -}}
<span class="tag"><a href="{{ "categories/" | absLangURL }}{{ . | urlize }}/">{{.}}</a></span>
{{ end }}
</p>
{{ end }}

@ -0,0 +1,7 @@
<link rel="apple-touch-icon" sizes="180x180" href="{{"apple-touch-icon.png" | relURL}}">
<link rel="icon" type="image/png" sizes="32x32" href="{{"favicon-32x32.png" | relURL}}">
<link rel="icon" type="image/png" sizes="16x16" href="{{"favicon-16x16.png" | relURL}}">
<link rel="manifest" href="{{"site.webmanifest" | relURL}}">
<link rel="mask-icon" href="{{"safari-pinned-tab.svg" | relURL}}" color="{{.Site.Params.favicon.mask}}">
<link rel="shortcut icon" href="{{"favicon.ico" | relURL}}">
<meta name="msapplication-TileColor" content="{{.Site.Params.favicon.msapplication}}">

@ -0,0 +1,20 @@
<footer class="footer">
{{if or (.Site.Params.footer.trademark) (.Site.Params.footer.author) (.Site.Params.footer.copyright) (.Site.Params.footer.rss) (.Site.Params.footer.topText) }}
<div class="footer__inner">
<div class="footer__content">
{{ if .Site.Params.footer.trademark }}<span>&copy; {{ now.Format "2006" }}</span>{{ end }}
{{ if .Site.Params.footer.author }}<span><a href="{{ .Site.BaseURL }}">{{ .Site.Author.name }}</a></span>{{ end }}
{{ if .Site.Params.footer.copyright }}<span>{{ .Site.Copyright| safeHTML }}</span>{{ end }}
{{ if .Site.Params.footer.rss }}<span><a href="{{ "posts/index.xml" | absLangURL }}" target="_blank" title="rss"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-rss"><path d="M4 11a9 9 0 0 1 9 9"></path><path d="M4 4a16 16 0 0 1 16 16"></path><circle cx="5" cy="19" r="1"></circle></svg></a></span>{{ end }}
{{ range .Site.Params.footer.topText }}<span>{{ . | safeHTML}}</span>{{ end }}
</div>
</div>
{{ end }}
{{with .Site.Params.footer.bottomText}}
<div class="footer__inner">
<div class="footer__content">
{{ range . }}<span>{{ . | safeHTML}}</span>{{ end }}
</div>
</div>
{{ end }}
</footer>

@ -0,0 +1,74 @@
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="author" content="{{ if .Params.author }}{{ .Params.author }}{{ else }}{{ range .Site.Author }}{{ . }} {{ end }}{{ end }}">
<meta name="description" content="{{ if .IsHome }}{{ .Site.Params.homeSubtitle }}{{ else }}{{ if .Params.Description }}{{ .Params.Description }}{{ else }}{{ .Summary | plainify }}{{ end }}{{ end }}" />
<meta name="keywords" content="{{ .Site.Params.keywords }}{{ if .Params.tags }}{{ range .Params.tags }}, {{ . }}{{ end }}{{ end }}" />
<meta name="robots" content="noodp" />
<meta name="theme-color" content="{{ .Site.Params.themeColor }}" />
<link rel="canonical" href="{{ .Permalink }}" />
{{ block "title" . }}
<title>
{{ if .IsHome }}
{{ $.Site.Title }} {{ with $.Site.Params.Subtitle }} — {{ . }} {{ end }}
{{ else }}
{{ .Title }} :: {{ $.Site.Title }} {{ with $.Site.Params.Subtitle }} — {{ . }}{{ end }}
{{ end }}
</title>
{{ end }}
<!-- CSS -->
{{ $options := (dict "targetPath" "main.css" "outputStyle" "compressed" "enableSourceMap" true) }}
{{ $style := resources.Get "scss/main.scss" | resources.ToCSS $options | resources.Fingerprint }}
<link rel="stylesheet" href="{{ $style.RelPermalink }}" integrity="{{ $style.Data.Integrity }}">
{{ range $val := $.Site.Params.customCSS }}
{{ if gt (len $val) 0 }}
<link rel="stylesheet" type="text/css" href="{{ $val }}">
{{ end }}
{{ end }}
<!-- Icons -->
{{- partial "favicons.html" . }}
{{ template "_internal/schema.html" . }}
{{ template "_internal/twitter_cards.html" . }}
{{ if isset .Site.Taxonomies "series" }}
{{ template "_internal/opengraph.html" . }}
{{ end }}
{{ range .Params.categories }}
<meta property="article:section" content="{{ . }}" />
{{ end }}
{{ if isset .Params "date" }}
<meta property="article:published_time" content="{{ time .Date }}" />
{{ end }}
<!-- RSS -->
{{ with .OutputFormats.Get "rss" -}}
{{ printf `<link rel="%s" type="%s" href="%s" title="%s" />` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }}
{{ end -}}
<!-- JSON Feed -->
{{ if .OutputFormats.Get "json" }}
<link href="{{ if .OutputFormats.Get "json" }}{{ .Site.BaseURL }}feed.json{{ end }}" rel="alternate"
type="application/json" title="{{ .Site.Title }}" />
{{ end }}
<!-- Custom head tags -->
{{- if templates.Exists "partials/extra-head.html" -}}
{{ partial "extra-head.html" . }}
{{- end }}
<!-- Google Analytics internal template -->
{{- if .Site.GoogleAnalytics }}
{{ template "_internal/google_analytics.html" . }}
{{- end}}
<!-- Plausible.io -->
{{- if $.Site.Params.plausibleDataDomain }}
<script defer data-domain="{{ .Site.Params.plausibleDataDomain }}" src="{{ .Site.Params.plausibleScriptSource }}"></script>
{{- end}}

@ -0,0 +1,21 @@
<header class="header">
<span class="header__inner">
{{ partial "logo.html" . }}
<span class="header__right">
{{ if len .Site.Menus }}
{{ partial "menu.html" . }}
<span class="menu-trigger">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<path d="M0 0h24v24H0z" fill="none"/>
<path d="M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z"/>
</svg>
</span>
{{ end }}
{{- if .Site.Params.EnableThemeToggle }}
<span class="theme-toggle not-selectable">{{ partial "theme-toggle-icon.html" . }}</span>
{{- end}}
</span>
</span>
</header>

@ -0,0 +1,10 @@
{{ $main := resources.Get "js/main.js" }}
{{ $menu := resources.Get "js/menu.js" }}
{{ $secureJS := slice $main $menu | resources.Concat "bundle.js" | resources.Minify | resources.Fingerprint "sha512" }}
<script type="text/javascript" src="{{ $secureJS.RelPermalink }}" integrity="{{ $secureJS.Data.Integrity }}"></script>
{{ range $val := $.Site.Params.customJS }}
{{ if gt (len $val) 0 }}
<script src="{{ $val }}"></script>
{{ end }}
{{ end }}

@ -0,0 +1,16 @@
<a href="{{ if .Site.Params.Logo.LogoHomeLink }}{{ .Site.Params.Logo.LogoHomeLink }}{{ else }}{{ .Site.BaseURL | relLangURL }}{{ end }}" style="text-decoration: none;">
<div class="logo">
{{ if .Site.Params.Logo.path }}
<img src="{{ .Site.Params.Logo.path }}" alt="{{ .Site.Params.Logo.alt }}" />
{{ else }}
<span class="logo__mark">{{ with .Site.Params.Logo.logoMark }}{{ . }}{{ else }}>{{ end }}</span>
<span class="logo__text {{ with.Site.Params.Logo.logoCursorPathname}}logo__pathname{{ end }}">
{{ with .Site.Params.Logo.logoText }}{{ . }}{{ else }}hello{{ end }}</span>
<span class="logo__cursor" style=
"{{ with.Site.Params.Logo.logoCursorDisabled }}visibility:hidden;{{ end }}
{{ with.Site.Params.Logo.logoCursorColor }}background-color:{{ . }};{{ end }}
{{ with.Site.Params.Logo.logoCursorAnimate }}animation-duration:{{ . }};{{ end }}">
</span>
{{ end }}
</div>
</a>

@ -0,0 +1,23 @@
<nav class="menu">
<ul class="menu__inner">
{{- $currentPage := . -}}
{{ range .Site.Menus.main -}}
<li><a href="{{ .URL | relLangURL }}">{{ .Name }}</a></li>
{{- end }}
{{- if .Site.Params.EnableGlobalLanguageMenu }}
<div class="submenu">
<li class="dropdown">
<a href="javascript:void(0)" class="dropbtn">{{ .Language }}</a>
<div class="dropdown-content">
{{ if .Site.IsMultiLingual }}
{{ range $.Translations }}
<a title="{{ .Language }}" href="{{ .Permalink }}">{{ .Language }}</a>
{{ end }}
{{ end }}
</div>
</li>
</div>
{{- end }}
</ul>
</nav>

@ -0,0 +1,20 @@
<div class="pagination">
<div class="pagination__buttons">
{{ if .Paginator.HasPrev }}
<span class="button previous">
<a href="{{ .Paginator.Prev.URL }}">
<span class="button__icon"></span>
<span class="button__text">Newer posts</span>
</a>
</span>
{{ end }}
{{ if .Paginator.HasNext }}
<span class="button next">
<a href="{{ .Paginator.Next.URL }}">
<span class="button__text">Older posts</span>
<span class="button__icon"></span>
</a>
</span>
{{ end }}
</div>
</div>

@ -0,0 +1,30 @@
{{ if and (not $.Site.Params.DisableReadOtherPosts) (or .NextInSection .PrevInSection) }}
<div class="pagination">
{{ if .Site.Params.ReadOtherPosts }}
<div class="pagination__title">
<span class="pagination__title-h">{{ .Site.Params.ReadOtherPosts }}</span>
<hr />
</div>
{{ end }}
<div class="pagination__buttons">
{{ if .NextInSection }}
<span class="button previous">
<a href="{{ .NextInSection.Permalink }}">
<span class="button__icon"></span>
<span class="button__text">{{ .NextInSection.Title }}</span>
</a>
</span>
{{ end }}
{{ if .PrevInSection }}
<span class="button next">
<a href="{{ .PrevInSection.Permalink }}">
<span class="button__text">{{ .PrevInSection.Title }}</span>
<span class="button__icon"></span>
</a>
</span>
{{ end }}
</div>
</div>
{{ end }}

Some files were not shown because too many files have changed in this diff Show More