diff --git a/templates/base.html b/templates/base.html
index c5a12d7..dc6212b 100644
--- a/templates/base.html
+++ b/templates/base.html
@@ -18,6 +18,12 @@
{{ macros_head::resource() }}
{{ macros_head::stylesheet() }}
+{% if current_path -%}
+ {% set current_section = current_path | split(pat="/") | nth(n=1) -%}
+{% else -%}
+ {% set current_section = '/' -%}
+{% endif -%}
+
{% block seo %}
{% if config.extra.title_separator %}
{% set title_separator = " " ~ config.extra.title_separator ~ " " %}
diff --git a/templates/blog/page.html b/templates/blog/page.html
index ac334f9..1e106b9 100644
--- a/templates/blog/page.html
+++ b/templates/blog/page.html
@@ -3,8 +3,6 @@
{% extends "page.html" %}
{% block seo %}
- {# This value is matched by the config.extra.menu.main->section #}
- {% set_global current_section = 'blog' %}
{{ super() }}
{% endblock seo %}
diff --git a/templates/docs/page.html b/templates/docs/page.html
index d215d83..c304803 100644
--- a/templates/docs/page.html
+++ b/templates/docs/page.html
@@ -5,8 +5,6 @@
{% endblock body %}
{% block header %}
- {# This value is matched by the config.extra.menu.main~url #}
- {% set current_section = "docs" %}
{{ macros_header::header(current_section=current_section)}}
{% endblock header %}
diff --git a/templates/docs/section.html b/templates/docs/section.html
index 9f64835..24fb64e 100644
--- a/templates/docs/section.html
+++ b/templates/docs/section.html
@@ -5,8 +5,6 @@
{% endblock body %}
{% block header %}
- {# This value is matched by the config.extra.menu.main~section #}
- {% set current_section = "docs" %}
{{ macros_header::header(current_section=current_section)}}
{% endblock header %}