-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problem with nested collections #1097
Comments
There are plugins to generate these sorts of archives. Have you looked at how they implement this? I know this doesn't answer your questions directly. I'd just hate for you to waste time if there's a plugin that will get where you want to go. |
@Perlkonig This issue was opened long time ago in I did a more deep research and found a way how to solve my 2nd problem.
In md:
Desc do a recurse through folders and this good filter do a final job 👍 But it did't work for pagination (1st problem) 😞 3rd problem is still open... |
|
Can I use And what about my other questions? |
If you define If you access /2016 as a page, then it must have a markdown file in it, otherwise you'll get a 404. |
I solved problems with scope and need help with 1st and 3rd problems. |
@rhukster Why this issue was closed without any comment? |
oh sorry, i just read "I solved problems..." and thought you were all sorted. reopening. |
@rhukster Don't worry 😉 |
Why I can't use only one Documentation:
template: events
content:
items: @self.children
order:
by: date
dir: desc Error 404. UPDATEFinally I can reduce number of files with following: Every ---
content:
items: @self.descendants
order:
by: date
dir: desc
--- Multilang lines I put into {% extends 'partials/base.html.twig' %}
{% set level1 = page.title %}
{% set level2 = page.parent.title %}
{% set level3 = page.parent.parent.title %}
{% if level1|length == 2 and level2|length == 2 and level3|length == 4 %}
{% set myTitle = 'MONTHS_OF_THE_YEAR'|ta(level2|abs - 1) ~ " " ~ level1 ~ ", " ~ level3 %}
{% set mySubheader = t('HEADER.SUBHEADER_DAY') %}
{% elseif level1|length == 2 and level2|length == 4 %}
{% set myTitle = 'MONTHS_OF_THE_YEAR'|ta(level1|abs - 1) ~ " " ~ level2 %}
{% set mySubheader = t('HEADER.SUBHEADER_MONTH') %}
{% elseif level1|length == 4 %}
{% set myTitle = level1 %}
{% set mySubheader = t('HEADER.SUBHEADER_YEAR') %}
{% endif %}
{% block title %}{{ myTitle }} — {% endblock %}{% block content %}
{% set places = page.find('/places').header.places %}
{% set collection = page.collection().ofType('post') %}
...
<h1 class="brand-heading">{{ myTitle }}</h1>
<p class="intro-text">{{ mySubheader }}</p>
... @rhukster Can you add an option to use the same template in nested folders? This option removes the creation of files in each folder. ---
template: my-template
template_nested: events
--- |
Closing to due to inactivity |
@rhukster Because no answers from developers |
Hello!
I'm trying to implement Wordpress style archives in my Grav site.
For example,
Post: https://bestblog.wordpress.com/2007/06/13/elle-effect/
Day: https://bestblog.wordpress.com/2007/06/13/
Month: https://bestblog.wordpress.com/2007/06/
Year: https://bestblog.wordpress.com/2007/
I decided to use nested folders to work with it, but found some problems. First, I'm trying to work with adding year folders.
1_ Problem with pagination.
I use nested loop:
And my dump is always
null
, I can getyearCollection
pagination parameter only, notpostCollection
that I need.Can I get all nested items in one BIG collection and set pagination with it?
2_ Before year directories I used this construction to output events on main page:
process: twig: true markdown: false events: items: '@page': '/events' order: by: date dir: desc dateRange: start: today
Now with this code I can get only years, but can't get posts directly with
'@page': '/events-year'
, also it doesn't work with'@page': '/2016
. Why?3_ Third problem is copy&pasting the same files for post in every year directory:
Without them I get error 404.
Is it possible to get rid all of these problems?
The text was updated successfully, but these errors were encountered: