summaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authorVanja Cosic <1070957+vanjacosic@users.noreply.github.com>2023-04-03 14:31:13 +0200
committerVanja Cosic <1070957+vanjacosic@users.noreply.github.com>2023-04-03 14:31:13 +0200
commite0615a7638c6f86b3f059f1d900376d315fbfeea (patch)
tree290e24a5eb237371326b43b98f58d1c6c811e45b /templates
downloadcph-rust-website-e0615a7638c6f86b3f059f1d900376d315fbfeea.zip
Initial commit (the draft version from February)
Diffstat (limited to 'templates')
-rw-r--r--templates/base.html42
-rw-r--r--templates/index.html50
-rw-r--r--templates/page.html52
-rw-r--r--templates/shortcodes/list_events.md15
4 files changed, 159 insertions, 0 deletions
diff --git a/templates/base.html b/templates/base.html
new file mode 100644
index 0000000..e045191
--- /dev/null
+++ b/templates/base.html
@@ -0,0 +1,42 @@
+<!DOCTYPE html>
+<html lang="{{ lang }}">
+
+<head>
+ <meta charset="UTF-8">
+ <title>{% block title %}{{ config.title }}{% endblock title %}</title>
+ <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
+ <link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='0.9em' font-size='90'>🦀</text></svg>" />
+ <link href="https://fonts.googleapis.com/css?family=Fira+Sans:400,500,600&display=swap" rel="stylesheet">
+ <link rel="stylesheet" href="/styles.css">
+</head>
+
+<body>
+ {% block header %}
+ <header>
+ <nav>
+ <img class="logo" src="cph-rs-ferris.png">
+ <a href="/">
+ <h1>Copenhagen Rust Community</h1>
+ </a>
+ </nav>
+ </header>
+ {% endblock header %}
+
+ <main {% if page %}class="page-{{page.slug}}"{% endif %}>
+ {% block sidebar %}
+ {% endblock sidebar %}
+ <div class="content">
+ {% block content %}
+ {% endblock content %}
+ </div>
+ </main>
+
+ <footer>
+ <small>Last updated: {{ now()| date(format="%e %B at %H:%M", timezone="Europe/Berlin") }}</small>
+ </footer>
+
+ {% block script %}
+ {% endblock script %}
+</body>
+
+</html> \ No newline at end of file
diff --git a/templates/index.html b/templates/index.html
new file mode 100644
index 0000000..5822323
--- /dev/null
+++ b/templates/index.html
@@ -0,0 +1,50 @@
+{% extends "base.html" %}
+
+{% block sidebar %}
+ <aside class="menu">
+ {% set events = load_data(path="events.toml") %}
+
+ {%- set nextEvent = events.upcoming | last %}
+ {%- if nextEvent -%}
+ <h2>Next event</h2>
+
+ {% if nextEvent.url %}
+ <a class="title" href="{{ nextEvent.url }}">{{ nextEvent.title }}</a>
+ {% else %}
+ <span class="title">{{ nextEvent.title }}</span>
+ {% endif -%}
+ {% if nextEvent.date %}
+ <time datetime="{{ nextEvent.date }}">{{ nextEvent.date | date(format="%A, %e %B at %H:%M", timezone="Europe/Berlin") }}</time>
+ {% else %}
+ <div>(No date announced)</div>
+ {% endif -%}
+ {%- if not nextEvent.url -%}<div>(Link coming soon)</div>{%- endif -%}
+ {% endif %}
+
+ {%- set recentEvent = events.recent | first %}
+ {%- if recentEvent -%}
+ <h2>Recent event</h2>
+
+ {% if recentEvent.url %}
+ <a class="title" href="{{ recentEvent.url }}">{{ recentEvent.title }}</a>
+ {% else %}
+ <span class="title">{{ recentEvent.title }}</span>
+ {% endif -%}
+ {% if recentEvent.date %}
+ <time datetime="{{ recentEvent.date }}">{{ recentEvent.date | date(format="%A, %e %B", timezone="Europe/Berlin") }}</time>
+ {% else %}
+ <div>(No date found)</div>
+ {% endif -%}
+ {%- if not recentEvent.url -%}<div>(No link found)</div>{%- endif -%}
+ {% endif %}
+
+ <h2>Links</h2>
+ {% for menu in config.extra.menu %}
+ <a class="button" {% if menu.url %}href="{{ menu.url | safe }}"{% endif %}>{{ menu.title }}</a>
+ {%- endfor %}
+ </aside>
+{% endblock sidebar %}
+
+{% block content %}
+{{ section.content | safe }}
+{% endblock content %} \ No newline at end of file
diff --git a/templates/page.html b/templates/page.html
new file mode 100644
index 0000000..6e097b8
--- /dev/null
+++ b/templates/page.html
@@ -0,0 +1,52 @@
+{% extends "base.html" %}
+
+{% block title %}{{ page.title }} | {{ super() }} {% endblock title %}
+
+{% block sidebar %}
+<aside class="toc">
+ {% if section.toc %}{% set toc = section.toc %}{% elif page.toc %}{% set toc = page.toc %}{% endif %}
+ {% if toc %}
+ <div class="toc-sticky">
+ {% for h in toc %}
+ <div class="toc-item">
+ <a href="{{h.permalink | safe}}">{{ h.title }}</a>
+ </div>
+ {% if h.children %}
+ {% for h2 in h.children %}
+ <div class="toc-item-child">
+ <a href="{{h2.permalink | safe}}">{{ h2.title }}</a>
+ </div>
+ {% endfor %}
+ {% endif %}
+ {% endfor %}
+ </div>
+ {% endif %}
+</aside>
+{% endblock sidebar %}
+
+{% block content %}
+<h1>{{ page.title }}</h1>
+{{ page.content | safe }}
+{% endblock content %}
+
+{% block script %}
+<script>
+ const scrollHandler = entries => {
+ let entry = entries.find(entry => { return entry.isIntersecting && entry.intersectionRatio > 0.9; });
+ if (!entry) return;
+
+ document.querySelectorAll(".toc a").forEach((item) => {
+ item.classList.remove("active");
+ });
+
+ let link = document.querySelector(`.toc a[href$="${decodeURIComponent(`#${entry.target.id}`)}"]`)
+ if (link) {
+ link.classList.add("active");
+ link.scrollIntoView({ behavior: "auto", block: "nearest" });
+ }
+ };
+ const observer = new IntersectionObserver(scrollHandler, { threshold: 1 });
+ let items = document.querySelectorAll('h1,h2,h3,h4,h5,h6');
+ items.forEach(item => observer.observe(item));
+</script>
+{% endblock script %} \ No newline at end of file
diff --git a/templates/shortcodes/list_events.md b/templates/shortcodes/list_events.md
new file mode 100644
index 0000000..1b887c7
--- /dev/null
+++ b/templates/shortcodes/list_events.md
@@ -0,0 +1,15 @@
+{% set meetups = load_data(path="events.toml") %}
+
+{% if meetups[group] %}
+## {{ group | capitalize }}
+
+{% for item in meetups[group] %}
+### {{ item.title }}
+
+{% if item.url %}**Link:** [Meetup.com]({{ item.url }}){% endif %}
+**Date:** {% if item.date %}<time datetime="{{ item.date }}">{{ item.date | date(format="%A, %e %B %Y", timezone="Europe/Berlin") }}</time> {% else %}(No date found) {% endif %}
+**Venue:** {% if item.venue %}{{ item.venue }} – {% endif %}{% if item.address %}{{ item.address }} {% else %}(No venue) {% endif %}
+{% if item.content -%}**Description:**<blockquote>{{ item.content | safe }}</blockquote>{% endif %}
+
+{% endfor %}
+{% endif %}