diff options
| author | Alejandro Soto <alejandro@34project.org> | 2025-09-13 14:55:15 -0600 |
|---|---|---|
| committer | Alejandro Soto <alejandro@34project.org> | 2025-09-13 14:55:15 -0600 |
| commit | 87f85704af1fa866be83077b2b351c1fdad7c3ce (patch) | |
| tree | b49c8d49ef717e539bff6578992e692eea55d380 /themes/tabi-lean/templates/partials/main_page_posts_list.html | |
| parent | 1a4c3216f027d6a6f36104547377b7b21faa5015 (diff) | |
| parent | a2ea06d513a5802964f8f0ef5795cec7e548ed7b (diff) | |
Merge commit 'a2ea06d513a5802964f8f0ef5795cec7e548ed7b' as 'themes/tabi-lean'
Diffstat (limited to 'themes/tabi-lean/templates/partials/main_page_posts_list.html')
| -rw-r--r-- | themes/tabi-lean/templates/partials/main_page_posts_list.html | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/themes/tabi-lean/templates/partials/main_page_posts_list.html b/themes/tabi-lean/templates/partials/main_page_posts_list.html new file mode 100644 index 0000000..067e178 --- /dev/null +++ b/themes/tabi-lean/templates/partials/main_page_posts_list.html @@ -0,0 +1,61 @@ +{%- if paginator or extra_section -%} + <div id="posts-list"> + <div> + {{ macros_page_header::page_header(title=section.title) }} + </div> + + {# Check if both paginate_by and section_path are set #} + {%- set both_settings_set = paginator and extra_section -%} + {%- set paginator_has_no_pages = paginator and paginator.pages | length == 0 -%} + {%- set extra_section_has_pages = extra_section and extra_section.pages | length > 0 -%} + + {# Display warning if both settings are set #} + {%- if both_settings_set and paginator_has_no_pages and extra_section_has_pages -%} + <div class="admonition warning"> + <div class="admonition-icon admonition-icon-warning"></div> + <div class="admonition-content"> + <strong class="admonition-title">WARNING: Conflicting Configuration</strong> + <p> + No posts are displayed due to conflicting settings in your <code>_index.md</code>: + </p> + <ul> + <li><code>paginate_by</code> is set, but there are no posts to paginate in the current section.</li> + <li><code>section_path</code> is set, and posts are available in that section.</li> + </ul> + <p> + <strong>Solution:</strong> Remove <code>paginate_by</code> from your <code>_index.md</code>. + To limit the number of displayed posts, use <code>max_posts</code> in the <code>[extra]</code> section instead. + </p> + </div> + </div> + {%- endif -%} + + {# Get all posts for pinning if we're in root section with pagination #} + {%- if paginator and is_root_section -%} + {%- set root_section = get_section(path="_index.md") -%} + {%- set all_posts = root_section.pages -%} + {%- set pages = paginator.pages -%} + {%- elif paginator -%} + {%- set all_posts = paginator.pages -%} + {%- set pages = paginator.pages -%} + {%- else -%} + {%- set all_posts = extra_section.pages -%} + {%- set pages = extra_section.pages -%} + {%- endif -%} + + {% set max_posts = section.extra.max_posts | default(value=999999) %} + {{ macros_list_posts::list_posts( + posts=pages, + all_posts=all_posts, + max=max_posts, + language_strings=language_strings, + section_path=extra_section.path | default(value="blog"), + pinned_first=is_root_section, + current_page=paginator.current_index | default(value=1) + ) }} + </div> + + {% if paginator and paginator.pages | length > 0 %} + {%- include "partials/paginate.html" -%} + {% endif %} +{%- endif -%} |
