Scaffold containerized Django/Wagtail app with core features
This commit is contained in:
21
templates/base.html
Normal file
21
templates/base.html
Normal file
@@ -0,0 +1,21 @@
|
||||
{% load static core_tags %}
|
||||
<!DOCTYPE html>
|
||||
<html lang="en" class="dark">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>{% block title %}No Hype AI{% endblock %}</title>
|
||||
<script nonce="{{ request.csp_nonce|default:'' }}">
|
||||
(function(){try{if(localStorage.getItem('theme')==='light'){document.documentElement.classList.remove('dark');}}catch(e){}})();
|
||||
</script>
|
||||
<script src="{% static 'js/consent.js' %}" nonce="{{ request.csp_nonce|default:'' }}"></script>
|
||||
<script src="{% static 'js/theme.js' %}" defer></script>
|
||||
<script src="{% static 'js/prism.js' %}" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
{% include 'components/nav.html' %}
|
||||
{% include 'components/cookie_banner.html' %}
|
||||
<main>{% block content %}{% endblock %}</main>
|
||||
{% include 'components/footer.html' %}
|
||||
</body>
|
||||
</html>
|
||||
14
templates/blog/about_page.html
Normal file
14
templates/blog/about_page.html
Normal file
@@ -0,0 +1,14 @@
|
||||
{% extends 'base.html' %}
|
||||
{% load wagtailimages_tags wagtailcore_tags %}
|
||||
{% block content %}
|
||||
<h1>{{ page.title }}</h1>
|
||||
<p>{{ page.mission_statement }}</p>
|
||||
{{ page.body|richtext }}
|
||||
{% if page.featured_author %}
|
||||
<h2>{{ page.featured_author.name }}</h2>
|
||||
<p>{{ page.featured_author.bio }}</p>
|
||||
{% if page.featured_author.avatar %}
|
||||
{% image page.featured_author.avatar fill-200x200 %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
11
templates/blog/article_index_page.html
Normal file
11
templates/blog/article_index_page.html
Normal file
@@ -0,0 +1,11 @@
|
||||
{% extends 'base.html' %}
|
||||
{% load core_tags %}
|
||||
{% block title %}Articles | No Hype AI{% endblock %}
|
||||
{% block content %}
|
||||
<h1>{{ page.title }}</h1>
|
||||
{% for article in articles %}
|
||||
{% include 'components/article_card.html' with article=article %}
|
||||
{% empty %}
|
||||
<p>No articles found.</p>
|
||||
{% endfor %}
|
||||
{% endblock %}
|
||||
33
templates/blog/article_page.html
Normal file
33
templates/blog/article_page.html
Normal file
@@ -0,0 +1,33 @@
|
||||
{% extends 'base.html' %}
|
||||
{% load wagtailcore_tags wagtailimages_tags seo_tags %}
|
||||
{% block title %}{{ page.title }} | No Hype AI{% endblock %}
|
||||
{% block content %}
|
||||
<article>
|
||||
<h1>{{ page.title }}</h1>
|
||||
<p>{{ page.read_time_mins }} min read</p>
|
||||
{% if page.hero_image %}
|
||||
{% image page.hero_image fill-1200x630 %}
|
||||
{% endif %}
|
||||
{{ page.body }}
|
||||
{% article_json_ld page %}
|
||||
</article>
|
||||
<section>
|
||||
<h2>Related</h2>
|
||||
{% for article in related_articles %}
|
||||
<a href="{{ article.url }}">{{ article.title }}</a>
|
||||
{% endfor %}
|
||||
</section>
|
||||
{% if page.comments_enabled %}
|
||||
<section>
|
||||
<form method="post" action="{% url 'comment_post' %}">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="article_id" value="{{ page.id }}" />
|
||||
<input type="text" name="author_name" required />
|
||||
<input type="email" name="author_email" required />
|
||||
<textarea name="body" required></textarea>
|
||||
<input type="text" name="honeypot" style="display:none" />
|
||||
<button type="submit">Post comment</button>
|
||||
</form>
|
||||
</section>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
4
templates/blog/blocks/callout_block.html
Normal file
4
templates/blog/blocks/callout_block.html
Normal file
@@ -0,0 +1,4 @@
|
||||
<div class="callout icon-{{ value.icon }}">
|
||||
<h3>{{ value.heading }}</h3>
|
||||
{{ value.body }}
|
||||
</div>
|
||||
5
templates/blog/blocks/code_block.html
Normal file
5
templates/blog/blocks/code_block.html
Normal file
@@ -0,0 +1,5 @@
|
||||
{% load wagtailcore_tags %}
|
||||
<div class="code-block">
|
||||
{% if value.filename %}<div>{{ value.filename }}</div>{% endif %}
|
||||
<pre data-lang="{{ value.language }}"><code class="language-{{ value.language }}">{{ value.raw_code }}</code></pre>
|
||||
</div>
|
||||
5
templates/blog/blocks/image_block.html
Normal file
5
templates/blog/blocks/image_block.html
Normal file
@@ -0,0 +1,5 @@
|
||||
{% load wagtailimages_tags %}
|
||||
<figure>
|
||||
{% image value.image width-1024 alt=value.alt %}
|
||||
{% if value.caption %}<figcaption>{{ value.caption }}</figcaption>{% endif %}
|
||||
</figure>
|
||||
4
templates/blog/blocks/pull_quote_block.html
Normal file
4
templates/blog/blocks/pull_quote_block.html
Normal file
@@ -0,0 +1,4 @@
|
||||
<blockquote>
|
||||
<p>{{ value.quote }}</p>
|
||||
{% if value.attribution %}<cite>{{ value.attribution }}</cite>{% endif %}
|
||||
</blockquote>
|
||||
21
templates/blog/home_page.html
Normal file
21
templates/blog/home_page.html
Normal file
@@ -0,0 +1,21 @@
|
||||
{% extends 'base.html' %}
|
||||
{% block title %}No Hype AI{% endblock %}
|
||||
{% block content %}
|
||||
<section>
|
||||
{% if featured_article %}
|
||||
<h2>{{ featured_article.title }}</h2>
|
||||
<p>{{ featured_article.author.name }}</p>
|
||||
<p>{{ featured_article.read_time_mins }} min read</p>
|
||||
{% endif %}
|
||||
</section>
|
||||
<section>
|
||||
{% for article in latest_articles %}
|
||||
{% include 'components/article_card.html' with article=article %}
|
||||
{% endfor %}
|
||||
</section>
|
||||
<section>
|
||||
{% for article in more_articles %}
|
||||
{% include 'components/article_card.html' with article=article %}
|
||||
{% endfor %}
|
||||
</section>
|
||||
{% endblock %}
|
||||
8
templates/components/article_card.html
Normal file
8
templates/components/article_card.html
Normal file
@@ -0,0 +1,8 @@
|
||||
{% load core_tags %}
|
||||
<article>
|
||||
<a href="{{ article.url }}">{{ article.title }}</a>
|
||||
<p>{{ article.summary|truncatewords:20 }}</p>
|
||||
{% for tag in article.tags.all %}
|
||||
<span class="{{ tag|get_tag_css }}">{{ tag.name }}</span>
|
||||
{% endfor %}
|
||||
</article>
|
||||
12
templates/components/cookie_banner.html
Normal file
12
templates/components/cookie_banner.html
Normal file
@@ -0,0 +1,12 @@
|
||||
{% if request.consent.requires_prompt %}
|
||||
<div id="cookie-banner">
|
||||
<form method="post" action="{% url 'consent' %}">
|
||||
{% csrf_token %}
|
||||
<button type="submit" name="accept_all" value="1">Accept all</button>
|
||||
<button type="submit" name="reject_all" value="1">Reject all</button>
|
||||
</form>
|
||||
{% if site_settings and site_settings.privacy_policy_page %}
|
||||
<a href="{{ site_settings.privacy_policy_page.url }}">Privacy Policy</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
7
templates/components/footer.html
Normal file
7
templates/components/footer.html
Normal file
@@ -0,0 +1,7 @@
|
||||
{% load core_tags %}
|
||||
<footer>
|
||||
{% get_legal_pages as legal_pages %}
|
||||
{% for page in legal_pages %}
|
||||
<a href="{{ page.url }}">{{ page.title }}</a>
|
||||
{% endfor %}
|
||||
</footer>
|
||||
5
templates/components/nav.html
Normal file
5
templates/components/nav.html
Normal file
@@ -0,0 +1,5 @@
|
||||
<nav>
|
||||
<a href="/">Home</a>
|
||||
<a href="/articles/">Articles</a>
|
||||
<a href="/about/">About</a>
|
||||
</nav>
|
||||
3
templates/core/robots.txt
Normal file
3
templates/core/robots.txt
Normal file
@@ -0,0 +1,3 @@
|
||||
User-agent: *
|
||||
Disallow: /cms/
|
||||
Sitemap: {{ request.scheme }}://{{ request.get_host }}/sitemap.xml
|
||||
7
templates/legal/legal_page.html
Normal file
7
templates/legal/legal_page.html
Normal file
@@ -0,0 +1,7 @@
|
||||
{% extends 'base.html' %}
|
||||
{% load wagtailcore_tags %}
|
||||
{% block content %}
|
||||
<h1>{{ page.title }}</h1>
|
||||
<p>Last updated: {{ page.last_updated|date:'F Y' }}</p>
|
||||
{{ page.body|richtext }}
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user