feat: add basic site
This commit is contained in:
22
templates/base.html
Normal file
22
templates/base.html
Normal file
@@ -0,0 +1,22 @@
|
||||
{% import "macros/macros.html" as post_macros %}
|
||||
{% import "macros/prev.html" as prev_macros %}
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>kasperhermansen</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
|
||||
|
||||
<link rel="stylesheet" href="{{ get_url(path="styles/styles.css") | safe }}" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<section class="section container mx-auto">
|
||||
{% block content %} {% endblock %}
|
||||
</section>
|
||||
</body>
|
||||
|
||||
</html>
|
1
templates/index.html
Normal file
1
templates/index.html
Normal file
@@ -0,0 +1 @@
|
||||
{% extends "section.html" %}
|
36
templates/macros/macros.html
Normal file
36
templates/macros/macros.html
Normal file
@@ -0,0 +1,36 @@
|
||||
{% macro list_posts(pages) %}
|
||||
<ul>
|
||||
{%- for page in pages %}
|
||||
<section class="list-item">
|
||||
<h1 class="title text-peach">
|
||||
<a href={{ page.permalink }}>{{page.title}}</a>
|
||||
</h1>
|
||||
|
||||
<div class="meta">
|
||||
{%- if page.date %}
|
||||
<time>{{ page.date | date(format="%Y-%m-%d") }}</time>
|
||||
{% endif -%}
|
||||
{% if page.draft %}
|
||||
<span class="draft-label">DRAFT</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<br />
|
||||
<div class="blog-summary ">
|
||||
{% if page.description %}
|
||||
{{ page.description }}
|
||||
{% elif page.summary %}
|
||||
{{ page.summary | safe }}…
|
||||
{% else %}
|
||||
{% set hide_read_more = true %}
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
{% if not hide_read_more %}
|
||||
<a class="readmore text-peach" href={{ page.permalink }}>Read more ⟶</a>
|
||||
{% endif %}
|
||||
</section>
|
||||
|
||||
{% endfor -%}
|
||||
</ul>
|
||||
{% endmacro list_posts %}
|
10
templates/macros/prev.html
Normal file
10
templates/macros/prev.html
Normal file
@@ -0,0 +1,10 @@
|
||||
|
||||
{% macro page_back_link(page) %}
|
||||
{% set top_section = get_section(path=page.ancestors | last) %}
|
||||
<a class="previous" href="{{ top_section.permalink }}">‹ back</a>
|
||||
{% endmacro page_back_link %}
|
||||
|
||||
{% macro section_back_link(section) %}
|
||||
{% set top_section = get_section(path=section.ancestors | last) %}
|
||||
<a class="previous" href="{{ top_section.permalink }}">‹ back</a>
|
||||
{% endmacro section_back_link %}
|
29
templates/page.html
Normal file
29
templates/page.html
Normal file
@@ -0,0 +1,29 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
{{ prev_macros::page_back_link(page=page) }}
|
||||
|
||||
<div class="mx-auto px-4 max-w-3xl py-8">
|
||||
<article class="blog-content">
|
||||
<h1 class="title">
|
||||
{{ page.title }}
|
||||
</h1>
|
||||
<p class="subtitle"><strong>{{ page.date }}</strong></p>
|
||||
{{ page.content | safe }}
|
||||
</article>
|
||||
|
||||
{% if page.lower or page.higher %}
|
||||
<div class="flex place-content-around max-w-lg mx-auto">
|
||||
{% if page.lower %}
|
||||
<a class="previous" href="{{ page.lower.permalink }}">‹ {{ page.lower.title }}</a>
|
||||
{% endif %}
|
||||
{% if page.higher %}
|
||||
<a class="next" href="{{ page.higher.permalink }}">{{ page.higher.title }} ›</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
{% endblock content %}
|
||||
|
45
templates/section.html
Normal file
45
templates/section.html
Normal file
@@ -0,0 +1,45 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
|
||||
{% block content %}
|
||||
|
||||
<div class="container mx-auto px-4 max-w-3xl py-8 space-y-4">
|
||||
|
||||
{% if section.ancestors | length > 0 %}
|
||||
{{ prev_macros::section_back_link(section=section) }}
|
||||
{% endif %}
|
||||
|
||||
{% if section.extra.section_path -%}
|
||||
{% set section = get_section(path=section.extra.section_path) %}
|
||||
{% endif -%}
|
||||
<h1 class="title text-peach text-3xl">
|
||||
{{ section.title }}
|
||||
</h1>
|
||||
|
||||
<main>
|
||||
{%- if paginator %}
|
||||
{%- set show_pages = paginator.pages -%}
|
||||
{% else %}
|
||||
{%- set show_pages = section.pages -%}
|
||||
{% endif -%}
|
||||
|
||||
{{ post_macros::list_posts(pages=show_pages) }}
|
||||
</main>
|
||||
{% if paginator %}
|
||||
<ul class="pagination">
|
||||
{% if paginator.previous %}
|
||||
<span class="page-item page-prev">
|
||||
<a href={{ paginator.previous }} class="page-link" aria-label="Previous"><span aria-hidden="true">← Prev</span></a>
|
||||
</span>
|
||||
{% endif %}
|
||||
|
||||
{% if paginator.next %}
|
||||
<span class="page-item page-next">
|
||||
<a href={{ paginator.next }} class="page-link" aria-label="Next"><span aria-hidden="true">Next →</span></a>
|
||||
</span>
|
||||
{% endif %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
{% endblock content %}
|
Reference in New Issue
Block a user