Added support for brief description of article for SEO

Signed-off-by: Louis Vallat <louis@louis-vallat.xyz>
This commit is contained in:
Louis Vallat 2022-01-18 12:16:48 +01:00
parent 5feeca1e9b
commit 0e49ead29a
No known key found for this signature in database
GPG Key ID: 0C87282F76E61283
5 changed files with 23 additions and 9 deletions

View File

@ -16,16 +16,16 @@ PAGE CODED BY :
<link rel="icon" href="/assets/images/icon.png">
<!-- SEO -->
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Un article disponible sur le blog de Louis Vallat.">
<meta name="description" content="">
<meta name="image" content="https://blog.louis-vallat.xyz/assets/images/icon.png">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="">
<meta name="twitter:description" content="Un article disponible sur le blog de Louis Vallat.">
<meta name="twitter:description" content="">
<meta name="twitter:site" content="@VallatLouis">
<meta name="twitter:creator" content="@VallatLouis">
<meta name="twitter:image:src" content="https://blog.louis-vallat.xyz/assets/images/icon.png">
<meta name="og:title" content="">
<meta name="og:description" content="Un article disponible sur le blog de Louis Vallat.">
<meta name="og:description" content="">
<meta name="og:image" content="https://blog.louis-vallat.xyz/assets/images/icon.png">
<meta name="og:url" content="https://blog.louis-vallat.xyz/">
<meta name="og:site_name" content="Le blog de Louis Vallat">

View File

@ -1,6 +1,6 @@
# AoC 2021 Jour 0: Commencement
> Le début d'une grande aventure !
Le début d'une grande aventure !
Cette année, j'ai découvert l'[Advent Of Code](https://adventofcode.com/).
Ce site géré de manière bénévole par [Eric Wastl](http://was.tl/) sur son temps

View File

@ -1,11 +1,11 @@
# Git Workflow
Git est un outil de versionnage très utile, voici comment je m'en sers.
> À noter que ce guide est destiné aux personnes qui ont déjà utilisé git auparavant,
> il ne s'agit pas ici d'un tutoriel pour débutants (bien que je sois ici assez
> exhaustif dans mes explications).
Git est un outil de versionnage très utile, voici comment je m'en sers.
[TL;DR](#TL;DR)
## Les fondations

View File

@ -1,5 +1,7 @@
#### Articles
Un blog on ne peut plus simple.
- [Advent of Code 2021 Jour 0 : le commencement](./aoc-2021-jour-0-commencement.html) - *17/01/2022*
- [Git workflow](./git_flow.html) - *10/05/2021*

18
ssg5
View File

@ -188,13 +188,12 @@ render_html_files() {
render_md_files_lowdown() {
# Check if the previous file has a date in it
while read -r f
do
lowdown \
--html-no-skiphtml \
--html-no-escapehtml < "$1/$f" |
render_html_file "$3" > "$2/${f%\.md}.html"
render_html_file "$3" "$(head -n 3 ${1}/${f} | tail -n 1)" > "$2/${f%\.md}.html"
done
}
@ -211,7 +210,8 @@ render_md_files_Markdown_pl() {
render_html_file() {
# h/t Devin Teske
awk -v title="$1" '
# TODO IMPROVE THIS IF POSSIBLE
awk -v title="${1}" -v brief="${2}" '
{ body = body "\n" $0 }
END {
body = substr(body, 2)
@ -239,6 +239,18 @@ render_html_file() {
head = substr(header[i], 1, RSTART - 1)
tail = substr(header[i], RSTART + RLENGTH)
print head "<title>" title "</title>" tail
} else if (match(tolower(header[i]), "<meta name=\"twitter:description\" content=\"\">")) {
head = substr(header[i], 1, RSTART - 1)
tail = substr(header[i], RSTART + RLENGTH)
print head "<meta name=\"twitter:description\" content=\"" brief "\">" tail
} else if (match(tolower(header[i]), "<meta name=\"description\" content=\"\">")) {
head = substr(header[i], 1, RSTART - 1)
tail = substr(header[i], RSTART + RLENGTH)
print head "<meta name=\"description\" content=\"" brief "\">" tail
} else if (match(tolower(header[i]), "<meta name=\"og:description\" content=\"\">")) {
head = substr(header[i], 1, RSTART - 1)
tail = substr(header[i], RSTART + RLENGTH)
print head "<meta name=\"og:description\" content=\"" brief "\">" tail
} else print header[i]
}
print body