Skip to content

Commit

Permalink
Date based announce
Browse files Browse the repository at this point in the history
  • Loading branch information
ericholscher committed Feb 12, 2025
1 parent 095cd4c commit 9544064
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
4 changes: 4 additions & 0 deletions docs/_templates/layout.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
{%- extends "!layout.html" %}

{%- block document %}

{%- if announcement_message %}
<div class="announcement-banner-wrapper">
<div class="announcement-banner">
<p>{{ announcement_message | safe }}</p>
</div>
</div>
{%- endif %}

<div class="documentwrapper">
{%- if render_sidebar %}
<div class="bodywrapper">
Expand Down
9 changes: 7 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import os
import sys
import datetime

import yaml
import ablog
Expand Down Expand Up @@ -214,8 +215,12 @@ def _load_data(self, env, data_source, encoding):
comment: Community sponsor
""")

# Announcement message
announcement_message = "Portland 2025 speakers announced. <a href='/conf/portland/2025/'>Buy your ticket now</a>"
# Dynamic announcement message
today = datetime.date.today()
announcement_message = None

if datetime.date(2025, 2, 1) <= today <= datetime.date(2025, 5, 4):
announcement_message = "Portland 2025 speakers announced. <a href='/conf/portland/2025/'>Buy your ticket now.</a>"

html_context = {
'conf_py_root': os.path.dirname(os.path.abspath(__file__)),
Expand Down

0 comments on commit 9544064

Please sign in to comment.