Home section title can be disabled

This commit is contained in:
southerntofu 2020-04-22 18:13:39 +02:00
parent 222d35bf3b
commit 9cb9250f46
3 changed files with 13 additions and 4 deletions

View File

@ -37,7 +37,7 @@
{% block main %}
{% if config.extra.home_section %}
{% set home_section = config.extra.home_section ~ "/_index.md" %}
{{ widgets::section(cur_section=get_section(path=widgets::i18n_path(path=home_section)), full_articles=config.extra.home_fullarticles) }}
{{ widgets::section(cur_section=get_section(path=widgets::i18n_path(path=home_section)), full_articles=config.extra.home_fullarticles, title=config.extra.home_sectiontitle) }}
{% else %}
{{ section.content | markdown | safe }}
{% endif %}

View File

@ -73,10 +73,16 @@ a submenu. A submenu is an actual list
{%- endmacro strip_lang_from_path -%}
{# Need to use separate names for variables, otherwise the paginator
collides with that of index.html #}
{% macro section(cur_section, cur_paginator=false, full_articles=true) %}
collides with that of index.html. Also, full_articles and section_title
are useful to home section #}
{% macro section(cur_section, cur_paginator=false, full_articles=true, title=true) %}
<section class="h-feed">
<h1><span class="p-name">{{ cur_section.title }}</span>{% if cur_paginator and cur_paginator.number_pagers > 1 %} ({{ cur_paginator.current_index }}/{{ cur_paginator.number_pagers }}){% endif %}</h1>
{% if title %}
<h1>
<span class="p-name">{{ cur_section.title }}</span>{% if cur_paginator and cur_paginator.number_pagers > 1 %} ({{ cur_paginator.current_index }}/{{ cur_paginator.number_pagers }}){% endif %}
</h1>
{% endif %}
{# Even if called from a different section (such as homepage), we want the semantic permalink to the collection to match the content #}
<a class="u-url" hidden aria-hidden=true href="{{ cur_section.permalink }}">Permalink</a>
{% set pages = cur_paginator.pages| default(value=cur_section.pages) %}
{% for page in pages %}

View File

@ -30,8 +30,11 @@ max_width = "800px"
# like "blog" for content/blog/. Pagination is defined by this section's
# pagination settings.
home_section = ""
# Show/hide home section title (only when home_section is set)
home_sectiontitle = true
# Determines whether to show full articles on the homepage. If disabled, it will
# only show summaries (if they are defined in the content), or the date/title.
# (only when home_section is set)
home_fullarticles = true