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