Add videos page

This commit is contained in:
Konstantin Nazarov 2023-10-26 00:34:18 +01:00
parent 3ae92fe625
commit a3f6130634
Signed by: knazarov
GPG key ID: 4CFE0A42FA409C22

View file

@ -1,69 +1,70 @@
#!/usr/bin/env bash
expand() {
TITLE="$1"
DATE="$(echo "$2" | sed 's/Z/.000Z/')"
cat <<-"EOF"
TITLE="$1"
DATE="$(echo "$2" | sed 's/Z/.000Z/')"
cat <<-"EOF"
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
EOF
if [ "$DATE" != "" ]; then
echo " <meta property=\"og:type\" content=\"article\">"
echo " <meta property=\"og:title\" content=\"$TITLE\">"
echo " <meta name=\"author\" content=\"Konstantin Nazarov\">"
echo " <meta property=\"article:published_time\" content=\"$DATE\"/>"
fi
if [ "$DATE" != "" ]; then
echo " <meta property=\"og:type\" content=\"article\">"
echo " <meta property=\"og:title\" content=\"$TITLE\">"
echo " <meta name=\"author\" content=\"Konstantin Nazarov\">"
echo " <meta property=\"article:published_time\" content=\"$DATE\"/>"
fi
cat <<-"EOF"
<link rel="stylesheet" type="text/css" href="/style.css">
<title>
cat <<-"EOF"
<link rel="stylesheet" type="text/css" href="/style.css">
<title>
EOF
echo " $TITLE"
echo " $TITLE"
cat <<-"EOF"
</title>
<link rel="alternate" type="application/rss+xml"
title="RSS Feed for knazarov.com" href="/rss.xml" />
cat <<-"EOF"
</title>
<link rel="alternate" type="application/rss+xml"
title="RSS Feed for knazarov.com" href="/rss.xml" />
</head>
<body>
<header id="header">
<a href="/">Konstantin Nazarov</a>
</header>
<nav id="menu">
<a href="/">home</a>
<a href="/posts">posts</a>
<a href="/projects">projects</a>
<a href="/cv">cv</a>
<a href="/contact">contact</a>
<a href="/rss.xml"><img src="/rss.png" style="height: 15px; width: auto; vertical-align:middle;"></img></a>
</nav>
<div id="content">
<header id="header">
<a href="/">Konstantin Nazarov</a>
</header>
<nav id="menu">
<a href="/">home</a>
<a href="/posts">posts</a>
<a href="https://videos.knazarov.com">videos</a>
<a href="/projects">projects</a>
<a href="/cv">cv</a>
<a href="/contact">contact</a>
<a href="/rss.xml"><img src="/rss.png" style="height: 15px; width: auto; vertical-align:middle;"></img></a>
</nav>
<div id="content">
EOF
cat
cat <<-"EOF"
</div>
cat
cat <<-"EOF"
</div>
</body>
</html>
EOF
}
if [ -z "$1" ]; then
echo "Missing page title"
exit 1
echo "Missing page title"
exit 1
fi
if [ -z "$2" ] && [ -t 0 ]; then
echo "Missing page body"
exit 1
echo "Missing page body"
exit 1
fi
if [ ! -t 0 ]; then
expand "$1" "$2"
exit 0
expand "$1" "$2"
exit 0
fi
expand "$1" "$2" < "$3"