Initial commit
commit
2bb9d87dbd
@ -0,0 +1,44 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Blog</title>
|
||||
<meta charset="UTF-8">
|
||||
</head>
|
||||
|
||||
<style type="text/css">
|
||||
html {
|
||||
font-family: Helvetica, Arial, sans-serif;
|
||||
color: #5b4636;
|
||||
background-color: #f4ecd8;
|
||||
}
|
||||
|
||||
body {
|
||||
padding: 1em;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
@media only all and (max-width: 499px) {
|
||||
body {
|
||||
font-size: 6vw;
|
||||
}
|
||||
}
|
||||
|
||||
@media only all and (min-width: 500px) {
|
||||
body {
|
||||
font-size: 20px;
|
||||
min-width: 500px;
|
||||
max-width: 50em;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<body>
|
||||
<a href="index.html">Home</a>
|
||||
<h1>Blog</h1>
|
||||
|
||||
<div><a href="./posts/introduction/index.html"><h2> Introduction </h2></a><p>Hello, welcome to my blog! My name is Hugo. I am a 22 year old Software
|
||||
Engineering student from the Netherlands. Software development is a huge part
|
||||
of my life, I write a lot of (weird) programs to scratch my own itch and most
|
||||
software I create is open_source by default. I also run a one-man company that
|
||||
provides some IT services on the side.</p></div><hr>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,101 @@
|
||||
#!/bin/bash
|
||||
##
|
||||
# Generate html page with blog article excerpts from ./posts.txt. Post file names should
|
||||
# be added to ./posts.txt in the exact order that they are supposed to appear on the blog
|
||||
# page.
|
||||
|
||||
# Check if required executables can be found
|
||||
if ! type readlink dirname html2text mv; then
|
||||
echo 'One or more required executables are not present. Generation cancelled' >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Determine script directory (requires GNU readlink)
|
||||
here="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
|
||||
|
||||
printf 'Changing directory: '
|
||||
pushd "$here" || exit $?
|
||||
|
||||
posts_file="$here/posts.txt"
|
||||
|
||||
if ! [[ -f "$posts_file" ]]; then
|
||||
printf 'Posts file "%s" not found. Generation cancelled.\n' "$posts_file" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
escape-html() {
|
||||
sed 's/&/\&/g; s/</\</g; s/>/\>/g; s/"/\"/g; s/'"'"'/\'/g'
|
||||
}
|
||||
|
||||
html-to-text() {
|
||||
html2text -nobs -style compact "$@"
|
||||
}
|
||||
|
||||
blog_html="$here/blog.html"
|
||||
|
||||
{
|
||||
echo '<html>
|
||||
<head>
|
||||
<title>Blog</title>
|
||||
<meta charset="UTF-8">
|
||||
</head>
|
||||
|
||||
<style type="text/css">
|
||||
html {
|
||||
font-family: Helvetica, Arial, sans-serif;
|
||||
color: #5b4636;
|
||||
background-color: #f4ecd8;
|
||||
}
|
||||
|
||||
body {
|
||||
padding: 1em;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
@media only all and (max-width: 499px) {
|
||||
body {
|
||||
font-size: 6vw;
|
||||
}
|
||||
}
|
||||
|
||||
@media only all and (min-width: 500px) {
|
||||
body {
|
||||
font-size: 20px;
|
||||
min-width: 500px;
|
||||
max-width: 50em;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<body>
|
||||
<a href="index.html">Home</a>
|
||||
<h1>Blog</h1>
|
||||
'
|
||||
while read -r post_html; do
|
||||
# Convert the post's html to text to make it easier to use the blog's text
|
||||
text="$(html-to-text "$post_html" | escape-html)" || exit $?
|
||||
|
||||
# The title should be on the 2nd line of text, right after the link to the
|
||||
# homepage. This is a bit inflexible but it will do for now.
|
||||
title="$(tail -n +2 <<<"$text" | head -n 1 | tr -d '*')" || exit $?
|
||||
|
||||
# Use the first 5 lines after the title as post excerpt.
|
||||
excerpt="$(tail -n +3 <<<"$text" | head -n 5)" || exit $?
|
||||
|
||||
# Escape the post html file name to safely use it in the generated html.
|
||||
href="$(escape-html <<<"$post_html")" || exit $?
|
||||
|
||||
printf '<div><a href="%s"><h2>%s</h2></a><p>%s</p></div><hr>\n' \
|
||||
"$href" \
|
||||
"$title" \
|
||||
"$excerpt"
|
||||
done < "$posts_file"
|
||||
|
||||
echo ' </body>
|
||||
</html>'
|
||||
|
||||
} > "$blog_html.new"
|
||||
|
||||
mv -v "$blog_html.new" "$blog_html" || exit $?
|
||||
|
||||
echo 'SUCCESS!'
|
@ -0,0 +1,43 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Hugot</title>
|
||||
<meta charset="UTF-8">
|
||||
</head>
|
||||
|
||||
<style type="text/css">
|
||||
html {
|
||||
font-family: Helvetica, Arial, sans-serif;
|
||||
color: #5b4636;
|
||||
background-color: #f4ecd8;
|
||||
}
|
||||
|
||||
body {
|
||||
padding: 1em;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
@media only all and (max-width: 499px) {
|
||||
body {
|
||||
font-size: 6vw;
|
||||
}
|
||||
}
|
||||
|
||||
@media only all and (min-width: 500px) {
|
||||
body {
|
||||
font-size: 20px;
|
||||
min-width: 500px;
|
||||
max-width: 50em;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<body>
|
||||
<a href="blog.html">Blog</a>
|
||||
<h1>Hugo's homepage</h1>
|
||||
<p>
|
||||
Hello and welcome to my personal homepage! I'll add some info about myself to
|
||||
this page soon. In the mean time, maybe take a look at my <a href="blog.html">blog</a>
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,63 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Introduction</title>
|
||||
<meta charset="UTF-8">
|
||||
</head>
|
||||
|
||||
<style type="text/css">
|
||||
html {
|
||||
font-family: Helvetica, Arial, sans-serif;
|
||||
color: #5b4636;
|
||||
background-color: #f4ecd8;
|
||||
}
|
||||
|
||||
body {
|
||||
padding: 1em;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
@media only all and (max-width: 499px) {
|
||||
body {
|
||||
font-size: 6vw;
|
||||
}
|
||||
}
|
||||
|
||||
@media only all and (min-width: 500px) {
|
||||
body {
|
||||
font-size: 20px;
|
||||
min-width: 500px;
|
||||
max-width: 50em;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<body>
|
||||
<a href="../../blog.html">Home</a>
|
||||
<h1>Introduction</h1>
|
||||
|
||||
<p>
|
||||
Hello, welcome to my blog! My name is Hugo. I am a 22 year old Software Engineering
|
||||
student from the Netherlands. Software development is a huge part of my life, I write a
|
||||
lot of (weird) programs to scratch my own itch and most software I create
|
||||
is <a href="https://github.com/hugot">open source</a> by default. I also run a one-man
|
||||
company that provides some IT services on the side.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Between working on projects and studying I like to watch movies & series, listen to music
|
||||
& podcasts, ride my road bike and take hikes.
|
||||
</p>
|
||||
|
||||
<h2>What kind of blog is this?</h2>
|
||||
<p>
|
||||
Because I'm quite new to this and I want to keep myself interested, I won't be
|
||||
limiting myself to a single topic. You can expect me to post about a variety of topics
|
||||
that may interest/annoy/excite me at any given moment.
|
||||
</p>
|
||||
|
||||
<p>May my posts be interesting and my posting schedule be consistent 🤓🖖</p>
|
||||
|
||||
<p>I hope to see you around! - Hugo</p>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue