]> git.ipfire.org Git - ipfire.org.git/commitdiff
blog: Move the encouragement to subscribe between the posts
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 5 Mar 2026 11:43:42 +0000 (11:43 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 5 Mar 2026 11:43:42 +0000 (11:43 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/templates/blog/index.html
src/templates/blog/modules/list.html
src/web/blog.py

index f17e82401b87d75238c41e7399aa3ba5803508ce..be9dbfec214bf853ebf0afa86961b7263bd8be2c 100644 (file)
        <section class="hero is-medium">
                <div class="hero-body">
                        <div class="container">
-                               <div class="columns is-vcentered">
-                                       <div class="column">
-                                               <h1 class="title">
-                                                       IPFire <span class="has-text-primary">Blog</span>
-                                               </h1>
-
-                                               <h5 class="subtitle is-5">
-                                                       {% if q %}
-                                                               {{ _("Search Results for '%s'") % q }}
-                                                       {% else %}
-                                                               Releases, security updates, and stories from the IPFire community
-                                                       {% end %}
-                                               </h5>
-                                       </div>
-
-                                       {# Encourage people to subscribe #}
-                                       {% if not current_user or not current_user.consents_to_promotional_emails %}
-                                               <div class="column is-one-quarter">
-                                                       <div class="card">
-                                                               <div class="card-content">
-                                                                       <div class="block">
-                                                                               <p class="heading">
-                                                                                       Newsletter
-                                                                               </p>
-
-                                                                               <p>
-                                                                                       <small>
-                                                                                               Get new posts and release notes delivered
-                                                                                               straight to your inbox. No spam.
-                                                                                       </small>
-                                                                               </p>
-                                                                       </div>
-
-                                                                       {# Show a button to sign up for anonymous users #}
-                                                                       {% if not current_user %}
-                                                                               <div class="block">
-                                                                                       <a class="button is-primary is-small is-fullwidth wrap-text" href="/join">
-                                                                                               <span class="icon">
-                                                                                                       <i class="fa-solid fa-envelope"></i>
-                                                                                               </span>
-                                                                                               <span>{{ _("Join Now & Subscribe") }}</span>
-                                                                                       </a>
-                                                                               </div>
-
-                                                                       {# Show a button to subscribe if users are logged in, but not yet subscribed #}
-                                                                       {% elif current_user and not current_user.consents_to_promotional_emails %}
-                                                                               <div class="block">
-                                                                                       <a class="button is-success is-fullwidth" href="/subscribe">
-                                                                                               <span class="icon">
-                                                                                                       <i class="fa-solid fa-envelope"></i>
-                                                                                               </span>
-                                                                                               <span>{{ _("Subscribe") }}</span>
-                                                                                       </a>
-                                                                               </div>
-                                                                       {% end %}
-                                                               </div>
-                                                       </div>
-                                               </div>
+                               <h1 class="title">
+                                       IPFire <span class="has-text-primary">Blog</span>
+                               </h1>
+
+                               <h5 class="subtitle is-5">
+                                       {% if q %}
+                                               {{ _("Search Results for '%s'") % q }}
+                                       {% else %}
+                                               Releases, security updates, and stories from the IPFire community
                                        {% end %}
-                               </div>
+                               </h5>
                        </div>
                </div>
        </section>
@@ -88,7 +39,7 @@
                                </div>
                        {% end %}
 
-                       {% module BlogList(posts, latest=latest_post) %}
+                       {% module BlogList(posts, latest=latest_post, encourage_to_subscribe=not q) %}
 
                        {# Show links to older years... #}
                        {% module BlogHistoryNavigation() %}
index 0553f5b2ac27af2bfb45f60b9c94e7bcd85f1f2f..29e4e55eec9b5c3933536d8d01068a0176c5dee3 100644 (file)
@@ -1,4 +1,4 @@
-{% for post in posts %}
+{% for i, post in enumerate(posts) %}
        {# Highlight the latest post #}
        {% set highlighted = (post == latest) %}
 
                        </div>
                </div>
        </div>
+
+       {# Encourage people to subscribe #}
+       {% if encourage_to_subscribe %}
+               {% if i == 0 %}
+                       {% if not current_user or not current_user.consents_to_promotional_emails %}
+                               <div class="columns">
+                                       <div class="column is-two-thirds">
+                                               <p>
+                                                       <strong>
+                                                               {{ _("Sign Up To Our Newsletter")}}
+                                                       </strong>
+                                               </p>
+
+                                               <p>
+                                                       <small>
+                                                               Get new posts and release notes delivered
+                                                               straight to your inbox. No spam.
+                                                       </small>
+                                               </p>
+                                       </div>
+
+                                       {# Show a button to sign up for anonymous users #}
+                                       {% if not current_user %}
+                                               <div class="column is-one-third">
+                                                       <a class="button is-primary is-fullwidth wrap-text" href="/join">
+                                                               <span class="icon">
+                                                                       <i class="fa-solid fa-envelope"></i>
+                                                               </span>
+
+                                                               <span>
+                                                                       {{ _("Join Now & Subscribe") }}
+                                                               </span>
+                                                       </a>
+                                               </div>
+
+                                       {# Show a button to subscribe if users are logged in, but not yet subscribed #}
+                                       {% elif current_user and not current_user.consents_to_promotional_emails %}
+                                               <div class="column is-one-third">
+                                                       <a class="button is-success is-fullwidth" href="/subscribe">
+                                                               <span class="icon">
+                                                                       <i class="fa-solid fa-envelope"></i>
+                                                               </span>
+
+                                                               <span>
+                                                                       {{ _("Subscribe") }}
+                                                               </span>
+                                                       </a>
+                                               </div>
+                                       {% end %}
+                               </div>
+                       {% end %}
+               {% end %}
+       {% end %}
 {% end %}
index 453de7d27d45da4bc6bdfec8071a6c05fdefab97..9d11abd7e2c5ab106bd6a15fc5878e56ccd4d89d 100644 (file)
@@ -238,9 +238,9 @@ class HistoryNavigationModule(ui_modules.UIModule):
 
 
 class ListModule(ui_modules.UIModule):
-       def render(self, posts, latest=None, show_author=True):
-               return self.render_string("blog/modules/list.html",
-                       posts=posts, latest=latest, show_author=show_author)
+       def render(self, posts, latest=None, show_author=True, encourage_to_subscribe=False):
+               return self.render_string("blog/modules/list.html", posts=posts, latest=latest,
+                       show_author=show_author, encourage_to_subscribe=encourage_to_subscribe)
 
 
 class TagModule(ui_modules.UIModule):