diff options
Diffstat (limited to 'templates')
| -rw-r--r-- | templates/404.html | 25 | ||||
| -rw-r--r-- | templates/base.html | 70 | ||||
| -rw-r--r-- | templates/feed.xml | 39 | ||||
| -rw-r--r-- | templates/index.html | 9 | ||||
| -rw-r--r-- | templates/macros/date.html | 3 | ||||
| -rw-r--r-- | templates/macros/header.html | 26 | ||||
| -rw-r--r-- | templates/page.html | 9 | ||||
| -rw-r--r-- | templates/post.html | 29 | ||||
| -rw-r--r-- | templates/posts.html | 35 | ||||
| -rw-r--r-- | templates/shortcodes/guestbook_entry.html | 25 | ||||
| -rw-r--r-- | templates/shortcodes/guestbook_form.html | 20 | ||||
| -rw-r--r-- | templates/shortcodes/img.html | 13 |
12 files changed, 303 insertions, 0 deletions
diff --git a/templates/404.html b/templates/404.html new file mode 100644 index 0000000..071d8bd --- /dev/null +++ b/templates/404.html @@ -0,0 +1,25 @@ +{% extends "base.html" %} + +{% block head_extra %} +<meta name="robots" content="noindex"> +{% endblock head_extra %} + +{% block title %}404 Page Not Found - {{ config.title }}{% endblock title %} +{% block description %}The requested resource was not found (404){% endblock description %} + +{% block og_title %}404 Page Not Found - {{ config.title }}{% endblock og_title %} +{% block og_description %}The requested resource was not found (404){% endblock og_description %} + +{% block main %} +<article> + <h1> + The requested page was not found. + </h1> + + <p> + The URL is either invalid or the page was deleted. + <br> + Anyways, <a href="/">Return to the homepage.</a> + </p> +<article/> +{% endblock main %} diff --git a/templates/base.html b/templates/base.html new file mode 100644 index 0000000..181d859 --- /dev/null +++ b/templates/base.html @@ -0,0 +1,70 @@ +{% import "macros/header.html" as header %} + +<!DOCTYPE html> +<html lang="en"> + <head> + <meta charset="UTF-8"> + <meta name="viewport" content="width=device-width,initial-scale=1"> + <meta name="author" content="{{ config.author }}"> + <meta name="robots" content="index,follow"> + <meta name="description" content="{% block description %}{{ config.description }}{% endblock description %}"> + {% block head_extra %}{% endblock head_extra %} + + {% if current_url %} + <link rel="canonical" href="{{ current_url | safe }}" /> + {% endif %} + <link rel="alternate" type="application/rss+xml" title="RSS" href="{{ config.extra.feed_url | safe }}"> + + <!-- OpenGraph --> + {% if current_url %} + <meta property="og:url" content="{{ current_url | safe }}" /> + {% endif %} + <meta property="og:site_name" content="{{ config.title }}" /> + <meta property="og:title" content="{% block og_title %}{{ config.title }}{% endblock og_title %}" /> + <meta property="og:description" content="{% block og_description %}{{ config.description }}{% endblock og_description %}" /> + <meta property="og:image" content="{% block og_image %}{{ config.extra.feature_image | safe }}{% endblock og_image %}" /> + <meta property="og:type" content="{% block og_type %}article{% endblock og_type %}" /> + + <link rel="stylesheet" type="text/css" href="/css/styles.css"> + + <title>{% block title %}{{ config.title }}{% endblock title %}</title> + </head> + + <body> + <div id="top"></div> + + <header id="site-header"> + {% block header %} + {% if page.path %} + {% set headerActivePage = page.path %} + {% else %} + {% set headerActivePage = "/" %} + {% endif %} + {{ header::site_header(activePage=headerActivePage) }} + {% endblock header %} + </header> + + <main> + {% block main %} + <article> + {{ page.content | safe }} + </article> + {% endblock main %} + </main> + + <footer id="site-footer"> + {% block footer %} + {% endblock footer %} + + <p id="copyright"> + Copyright © 2025 Vidhu Kant Sharma + <br> + The text and image content on this website is licensed under + <a href="https://creativecommons.org/licenses/by-nc-nd/4.0/">CC BY-NC-ND 4.0</a> + unless stated otherwise. + </p> + + <p id="top-link"><a href="#top">back to top</a></p> + </footer> + </body> +</html> diff --git a/templates/feed.xml b/templates/feed.xml new file mode 100644 index 0000000..8f7e3de --- /dev/null +++ b/templates/feed.xml @@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="UTF-8"?> +<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"> + <channel> + <title>{{ config.title }} + {%- if term %} - {{ term.name }} + {%- elif section.title %} - {{ section.title }} + {%- endif -%} + </title> + <link> + {%- if section -%} + {{ section.permalink | escape_xml | safe }} + {%- else -%} + {{ config.base_url | escape_xml | safe }} + {%- endif -%} + </link> + <description>{{ config.description }}</description> + <generator>Zola</generator> + <language>{{ lang }}</language> + <atom:link href="{{ config.extra.feed_url | safe }}" rel="self" type="application/rss+xml"/> + <lastBuildDate>{{ last_updated | date(format="%a, %d %b %Y %H:%M:%S %z") }}</lastBuildDate> + {%- for page in pages %} + <item> + <title>{{ page.title }}</title> + <pubDate>{{ page.date | date(format="%a, %d %b %Y %H:%M:%S %z") }}</pubDate> + <author>{{ config.extra.email }} ({{ config.author }})</author> + <link>{{ page.permalink | escape_xml | safe }}</link> + <guid>{{ page.permalink | escape_xml | safe }}</guid> + <description xml:base="{{ page.permalink | escape_xml | safe }}"> + {% if page.summary %} + {{ page.summary }} + {% else %} + <![CDATA[{{ page.content | safe}}<p><a href="mailto:{{ config.extra.email }}?subject=Post Reply: {{ page.title }}">Reply to this post via email</a></p>]]> + {% endif %} + </description> + </item> + {%- endfor %} + </channel> +</rss> + diff --git a/templates/index.html b/templates/index.html new file mode 100644 index 0000000..2b5296d --- /dev/null +++ b/templates/index.html @@ -0,0 +1,9 @@ +{% extends "base.html" %} + +{% block og_type %}website{% endblock og_type %} + +{% block main %} +<article> + {{ section.content | safe }} +</article> +{% endblock main %} diff --git a/templates/macros/date.html b/templates/macros/date.html new file mode 100644 index 0000000..020b47e --- /dev/null +++ b/templates/macros/date.html @@ -0,0 +1,3 @@ +{% macro format_date(date) %} +{{ date | date(format="%d %h, %Y") }} +{% endmacro format_date %} diff --git a/templates/macros/header.html b/templates/macros/header.html new file mode 100644 index 0000000..ff6cd44 --- /dev/null +++ b/templates/macros/header.html @@ -0,0 +1,26 @@ +{% macro site_header(activePage="") %} +<h1><a href="/">{{ config.title }}</a></h1> +<nav> + <ul> + <li> + <a href="/"{% if activePage == "/" %} id="nav-active-link"{% endif %}>Home</a> + </li> + + <li> + <a href="/posts"{% if activePage == "/posts" %} id="nav-active-link"{% endif %}>Posts</a> + </li> + + <li> + <a href="/about"{% if activePage == "/about/" %} id="nav-active-link"{% endif %}>About</a> + </li> + + <li> + <a href="/guestbook"{% if activePage == "/guestbook/" %} id="nav-active-link"{% endif %}>Guestbook</a> + </li> + + <li> + <a href="https://vidhukant.com" target="_blank">Main Website</a> + </li> + </ul> +</nav> +{% endmacro header %} diff --git a/templates/page.html b/templates/page.html new file mode 100644 index 0000000..7f4dd5b --- /dev/null +++ b/templates/page.html @@ -0,0 +1,9 @@ +{% extends "base.html" %} + +{% block title %}{{ page.title }} - {{ config.title }}{% endblock title %} +{% block description %}{{ page.description }}{% endblock description %} + +{% block og_title %}{{ page.title }} - {{ config.title }}{% endblock og_title %} +{% block og_description %}{{ page.description }}{% endblock og_description %} + +{% block og_type %}website{% endblock og_type %} diff --git a/templates/post.html b/templates/post.html new file mode 100644 index 0000000..e055397 --- /dev/null +++ b/templates/post.html @@ -0,0 +1,29 @@ +{% import "macros/header.html" as header %} +{% import "macros/date.html" as date %} + +{% extends "base.html" %} + +{% block title %}{{ page.title }} - {{ config.title }}{% endblock title %} +{% block description %}{{ page.description }}{% endblock description %} + +{% block og_title %}{{ page.title }} - {{ config.title }}{% endblock og_title %} +{% block og_description %}{{ page.description }}{% endblock og_description %} + +{% block header %} +{{ header::site_header(activePage="/posts") }} +{% endblock header %} + +{% block main %} +<article> + <header> + <h1>{{ page.title }}</h1> + <p> + <time datetime="{{ page.date }}"> + {{ date::format_date(date=page.date) }} + </time> + </p> + <hr> + </header> + {{ page.content | safe }} +</article> +{% endblock main %} diff --git a/templates/posts.html b/templates/posts.html new file mode 100644 index 0000000..c62e299 --- /dev/null +++ b/templates/posts.html @@ -0,0 +1,35 @@ +{% import "macros/header.html" as header %} +{% import "macros/date.html" as date %} + +{% extends "base.html" %} + +{% block title %}Index - {{ config.title }}{% endblock title %} +{% block description %}All posts on {{ config.title }}.{% endblock description %} + +{% block og_title %}Index - {{ config.title }}{% endblock og_title %} +{% block og_description %}All posts on {{ config.title }}{% endblock og_description %} + +{% block header %} +{{ header::site_header(activePage="/posts") }} +{% endblock header %} + +{% block main %} +<article> + {{ section.content | safe }} + + <ol id="post-index" reversed> + {% for post in section.pages %} + <li> + <a href="{{ post.path | safe }}"> + <time datetime="{{ post.date }}"> + <em>{{ date::format_date(date=post.date) }}</em> + </time> + <span> + {{ post.title }} + <span> + </a> + </li> + {% endfor %} + </ol> +</article> +{% endblock main %} diff --git a/templates/shortcodes/guestbook_entry.html b/templates/shortcodes/guestbook_entry.html new file mode 100644 index 0000000..69789ca --- /dev/null +++ b/templates/shortcodes/guestbook_entry.html @@ -0,0 +1,25 @@ +{% import "macros/date.html" as date %} + +<div class="guestbook-entry"> + <p> + {% if website %}<a href="{{ website | safe }}" target="_blank">{% endif %} + <strong class="guestbook-entry-name">{{ name | safe }}</strong> + {% if website %}</a>{% endif %} + <br> + <time datetime="{{ time }}"> + {{ date::format_date(date=time) }} + </time> + </p> + <p> + {{ message | safe }} + </p> + {% if reply %} + <blockquote> + <p> + {{ reply | safe }} + <br><br> + — {{ config.extra.nickname }} + </p> + </blockquote> + {% endif %} +</div> diff --git a/templates/shortcodes/guestbook_form.html b/templates/shortcodes/guestbook_form.html new file mode 100644 index 0000000..99dcf4c --- /dev/null +++ b/templates/shortcodes/guestbook_form.html @@ -0,0 +1,20 @@ +<form id="guestbook-form" method="POST" action="/guestbook/sign"> + <div class="form-entry"> + <label for="guestbook-name">Name:</label> + <input type="text" id="guestbook-name" name="name" placeholder="Name" required> + </div> + + <div class="form-entry"> + <label for="guestbook-website">Website:</label> + <input type="url" id="guestbook-website" name="website" placeholder="Website (optional)"> + </div> + + <div class="form-entry"> + <label for="guestbook-message">Message:</label> + <textarea id="guestbook-message" name="message" placeholder="Message" rows="5" required></textarea> + </div> + + <div class="form-entry"> + <input type="submit" value="Sign the guestbook"> + </div> +</form> diff --git a/templates/shortcodes/img.html b/templates/shortcodes/img.html new file mode 100644 index 0000000..8ff0820 --- /dev/null +++ b/templates/shortcodes/img.html @@ -0,0 +1,13 @@ +<figure> + {% if href %}<a href="{{ href }}">{% endif %} + <img src="{{ src }}" alt="{{ alt }}" + {% if title %}title="{{ title }}"{% endif %} + {% if height %}height="{{ height }}"{% endif %} + {% if width %}width="{{ width }}"{% endif %} + > + {% if href %}</a>{% endif %} + + {% if caption %} + <figcaption>{{ caption | safe }}</figcaption> + {% endif %} +</figure> |