mirror of
https://github.com/RealOrangeOne/notes.git
synced 2024-12-22 08:35:59 +00:00
List recent notes on homepage
This commit is contained in:
parent
93a375b482
commit
234e7046c0
4 changed files with 28 additions and 0 deletions
|
@ -1 +1,4 @@
|
|||
---
|
||||
template: home.html
|
||||
---
|
||||
# Notes
|
||||
|
|
2
hooks/notes.py
Normal file
2
hooks/notes.py
Normal file
|
@ -0,0 +1,2 @@
|
|||
def on_env(env, config, files):
|
||||
env.tests["startswith"] = str.startswith
|
|
@ -16,6 +16,7 @@ theme:
|
|||
icon:
|
||||
logo: fontawesome/regular/note-sticky
|
||||
favicon: https://theorangeone.net/favicon.ico
|
||||
custom_dir: theme/
|
||||
palette:
|
||||
# Palette toggle for light mode
|
||||
- scheme: default
|
||||
|
@ -33,6 +34,8 @@ theme:
|
|||
icon: material/brightness-4
|
||||
name: Switch to light mode
|
||||
|
||||
hooks:
|
||||
- hooks/notes.py
|
||||
|
||||
# Extensions
|
||||
markdown_extensions:
|
||||
|
|
20
theme/home.html
Normal file
20
theme/home.html
Normal file
|
@ -0,0 +1,20 @@
|
|||
{% extends "base.html" %}
|
||||
|
||||
{% block content %}
|
||||
{{ super() }}
|
||||
|
||||
<h2>Recent notes</h2>
|
||||
|
||||
<ul>
|
||||
{% for page in (nav.pages|selectattr("url", "startswith", "notes/")|sort(attribute="meta.git_creation_date_localized_raw_iso_datetime", reverse=True))[:10] %}
|
||||
<li>
|
||||
<a href="{{ page.url }}">{{ page.title }}</a> - {{ page.meta.git_creation_date_localized_raw_iso_date }}
|
||||
{% for tag in page.meta.tags %}
|
||||
<span class="md-tag">{{ tag }}</span>
|
||||
{% endfor %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
||||
<p><a href="{{ 'tags/'|url }}">View all →</a></p>
|
||||
{% endblock %}
|
Loading…
Reference in a new issue