From 699b6fc29ee213ea1ef1fe3be5c1eec24aac1980 Mon Sep 17 00:00:00 2001 From: Andrew Godwin Date: Thu, 22 Dec 2022 14:16:08 -0700 Subject: [PATCH] "Remove posts from front page" option --- core/models/config.py | 1 + templates/about.html | 2 +- users/views/admin/settings.py | 5 +++++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/core/models/config.py b/core/models/config.py index 2341598..cb40e60 100644 --- a/core/models/config.py +++ b/core/models/config.py @@ -201,6 +201,7 @@ class Config(models.Model): site_name: str = "Takahē" highlight_color: str = "#449c8c" site_about: str = "

Welcome!

\n\nThis is a community running Takahē." + site_frontpage_posts: bool = True site_icon: UploadedImage = StaticAbsoluteUrl("img/icon-128.png").relative # type: ignore site_banner: UploadedImage = StaticAbsoluteUrl( "img/fjords-banner-600.jpg" diff --git a/templates/about.html b/templates/about.html index 3c35f12..7f958dd 100644 --- a/templates/about.html +++ b/templates/about.html @@ -8,7 +8,7 @@ {{ content }} - {% if not request.user.is_authenticated %} + {% if not request.user.is_authenticated and config.site_frontpage_posts %}

Recent Posts

{% for post in posts %} diff --git a/users/views/admin/settings.py b/users/views/admin/settings.py index beb331e..97e91e0 100644 --- a/users/views/admin/settings.py +++ b/users/views/admin/settings.py @@ -51,6 +51,10 @@ class BasicSettings(AdminSettingsPage): "help_text": "Displayed on the homepage and the about page.\nUse Markdown for formatting.", "display": "textarea", }, + "site_frontpage_posts": { + "title": "Show Posts On Front Page", + "help_text": "Whether to show some recent posts on the logged-out homepage.", + }, "site_icon": { "title": "Site Icon", "help_text": "Minimum size 64x64px. Should be square.", @@ -95,6 +99,7 @@ class BasicSettings(AdminSettingsPage): "Branding": [ "site_name", "site_about", + "site_frontpage_posts", "site_icon", "site_banner", "highlight_color",