diff --git a/static/src/scss/content.scss b/static/src/scss/content.scss index 730dde4..c1fc550 100644 --- a/static/src/scss/content.scss +++ b/static/src/scss/content.scss @@ -22,3 +22,22 @@ h1.page-title { font-size: 4rem; margin-top: 1rem; } + +.header-image-spacer { + height: 1rem; +} + +.header-image { + height: calc(40vh - #{$navbar-height}); + + @media #{$medium-and-down} { + height: calc(60vh - #{$navbar-height}); + } + + // Fix darkreader weirdness + .parallax { + position: initial; + width: 100%; + height: 100%; + } +} diff --git a/static/src/scss/index.scss b/static/src/scss/index.scss index 5a64419..f800b3b 100644 --- a/static/src/scss/index.scss +++ b/static/src/scss/index.scss @@ -28,21 +28,6 @@ footer.page-footer { } } -.header-image { - height: calc(40vh - #{$navbar-height}); - - @media #{$medium-and-down} { - height: calc(60vh - #{$navbar-height}); - } - - // Fix darkreader weirdness - .parallax { - position: initial; - width: 100%; - height: 100%; - } -} - nav { a.sidenav-trigger { padding: 0 5px; diff --git a/templates/about.html b/templates/about.html index 2991c5b..7fdddb9 100644 --- a/templates/about.html +++ b/templates/about.html @@ -4,8 +4,6 @@ {% block title %}About{% endblock %} -{% block headerimage %}{% static "img/header.jpg" %}{% endblock %} - {% block content %}

diff --git a/templates/blog/index.html b/templates/blog/index.html index cf83b27..80b7931 100644 --- a/templates/blog/index.html +++ b/templates/blog/index.html @@ -4,8 +4,6 @@ {% block title %}Blog{% endblock %} -{% block headerimage %}{% static "img/header.jpg" %}{% endblock %} - {% block content %} {% endblock%} diff --git a/templates/content.html b/templates/content.html index ae17b4b..fa89ef0 100644 --- a/templates/content.html +++ b/templates/content.html @@ -1,11 +1,13 @@ {% extends "base.html" %} {% block main %} - {% block headerimagewrapper %} + {% if header_image %}
-
+
- {% endblock %} + {% else %} +
+ {% endif %}

{% block title %}{% endblock %}

diff --git a/website/blog/views.py b/website/blog/views.py index fffe0a4..0c670e6 100644 --- a/website/blog/views.py +++ b/website/blog/views.py @@ -1,5 +1,11 @@ +from django.templatetags.static import static from django.views.generic import TemplateView class BlogListView(TemplateView): template_name = "blog/index.html" + + def get_context_data(self, **kwargs): + context = super().get_context_data(**kwargs) + context["header_image"] = static("img/header.jpg") + return context diff --git a/website/common/views.py b/website/common/views.py index 155177b..96842cf 100644 --- a/website/common/views.py +++ b/website/common/views.py @@ -1,3 +1,4 @@ +from django.templatetags.static import static from django.views.generic import TemplateView @@ -7,3 +8,8 @@ class HomepageView(TemplateView): class AboutView(TemplateView): template_name = "about.html" + + def get_context_data(self, **kwargs): + context = super().get_context_data(**kwargs) + context["header_image"] = static("img/header.jpg") + return context