-
Notifications
You must be signed in to change notification settings - Fork 22
Paginating with proxy routes #1
Comments
So, here is the relevant part of my
As you can see, there are some variables involved that are used to pull data out of yaml files (in the templates as well). In the template for patterns.html I have the pagination frontmatter: pagination: Which is correctly read out by the extension. (Showing 2 per page) |
Thanks, @mkleywegt, this is great. I think I can help you out. I'll reproduce this first moment I get a chance and diagnose it from there. Can you post an example of your |
Hi @Aupajo, thanks again for looking at it. These lists get unwieldy, so I've abridged the contents. Here's
And
Let me know if you need anything else. |
Hey, sorry it's taken me a little while to get round to this issue. I've successfully reproduced the issue with the configuration you've supplied, which is good news as it means it'll be easier for me to diagnose the problem. As a side note, I found the YAML/proxy configuration set-up very hard to follow. If you're specifying slugs and making cross-references, you might find it easier to store the data in separate templates rather than in the YAML. For instance, you could have a set up that looks like:
You might find it cleaner. You might find this technique for extracting objects in Middleman of use, too. Stay tuned for the fix with the existing set-up, though. |
Okay, there are two steps to getting this working. The first is with the current configuration. The solution is to have a separate The second is the fact you're using directory-index-style paths in your proxies (e.g. the route is Once that fix is in place, I'll try to paste a working code example for you of how you can solve the first problem. |
Thank you for your suggestions. My inclination towards the YAML-heavy setup is easy of maintenance (hmm) by preventing duplicating templates (there would not have to be any difference between e.g. Having said that, I agree with your sentiment that it is hard to follow and certainly not clean enough (needing slugs et cetera). I will look into refactoring that. Extracting objects will help there too. I'll wait for your fix. |
@mkleywegt Thanks. You wouldn't have to have any duplication with the approach above (you can use layouts in place of proxied files). |
@mkleywegt Thanks for waiting! It took sitting down for a couple of hours to hash it out :D I've got a basic working example for you at https://github.com/Aupajo/middleman-example-for-mkleywegt It's fairly procedural, and it might be missing a layer of pagination indexes, but hopefully it's enough for you to go on. Some subtle things to note:
Hope that helps! |
@Aupajo - that is great work. Very much appreciated. Re: proxy paths ending in .html — while the .html is included in the proxy route in the config.rb (as per your example), visiting the proxy paths only works without appending .html . With this addition, I have the setup pretty much working. I posted a specific problem over in the other repository, see Memory leak (unless you'd like that here). |
And I noticed that paginated subpages use the lay-out assigned to the first page, but they don't have access to local variables. Where would I pass those? |
Hi Aupajo,
It is indeed getting rather specific. I realized that what I am trying to paginate are not really pages per se (they are now they have a route assigned to them). The payoff to this, I guess, would be having flexible general purpose pagination module for Middleman.
I will add an example for this later today.
Below is the original post from the Middleman Forum:
Background:
Here are my findings:
<middleman::pagination::inpagecontext etc.>
). It might not be able to work out the query, so it returns all the data. Subpages were not available as a result.I have experimented with including a variable to the pageable directive, with no notable difference.
I also tried to activate pagination within the loop that defines the proxy. Middleman then reports it already activated pagination (as it tries to do it a couple of times), also without a notable difference.
The text was updated successfully, but these errors were encountered: