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

request: exclude some files from pagination #10

Closed
item4 opened this Issue Dec 21, 2015 · 9 comments

Comments

Projects
None yet
2 participants
@item4
Contributor

item4 commented Dec 21, 2015

If I have these(see below) structure and add sitemap with this guide, my list must include sitemap.xml.

  • content/contents.lr
_model: blog

  • models/blog.ini
[model]
name = Blog
label = Blog
hidden = yes

[children]
model = blog-post
order_by = -pub_date, title
slug_format = {{ this.pub_date|dateformat('YYYY-MM-dd') }}/{{ this.title }}/

[pagination]
enabled = yes
per_page = 1

How can I pop sitemap.xml or some files (like keybase proof) from pagination? (Currently I make simple sitemap build package to avoid this problem)

@mitsuhiko

This comment has been minimized.

Member

mitsuhiko commented Dec 21, 2015

Yeah. That's something I want to do. This does not just affect pagination but general items that should not be included by children. This would also be useful for allowing pages to be generated but not appear to be discovered. Right now you can set a page to _hidden but that will make it not generate at all.

Need a name for this key. Maybe _reachable: no or something?

@item4

This comment has been minimized.

Contributor

item4 commented Dec 21, 2015

How about this way?

[pagination]
include_key = _reachable

or

[pagination]
exclude_key = _no_paging
@mitsuhiko

This comment has been minimized.

Member

mitsuhiko commented Dec 21, 2015

@item4 that would not even be necessary because the pagination would exclude this automatically. The pagination is based on the children and I want to be able to exclude things from children (which is what _hidden: yes already does) but still allow generation. This is a pretty minor change but I need to figure out the name for the field :)

@mitsuhiko

This comment has been minimized.

Member

mitsuhiko commented Dec 21, 2015

Maybe _discoverable: no?

@mitsuhiko

This comment has been minimized.

Member

mitsuhiko commented Dec 21, 2015

Secondly however, yes, there probably also needs to be a way to let the pagination work on other queries than just the normal children of the page.

@mitsuhiko

This comment has been minimized.

Member

mitsuhiko commented Dec 21, 2015

So basically to give this more context I think the problem is that right now lektor assumes a bit that you have something like a blog under a certain path if you also have other pages on the same level that follow a different model. So what you probably want to have is the ability to set the pagination to only consider a certain model. Maybe something like this:

[pagination]
items = this.children.filter(F._model == 'blog-post')

@mitsuhiko mitsuhiko added this to the 2.0 milestone Dec 21, 2015

@item4

This comment has been minimized.

Contributor

item4 commented Dec 22, 2015

👍 for both, _discoverable: no and items = this.children.filter(F._model == 'blog-post')

@mitsuhiko

This comment has been minimized.

Member

mitsuhiko commented Dec 22, 2015

master branch has _discoverable now. If you set _discoverable: no in a file (or untick the corresponding checkbox in the admin) a page is still being built but no longer picked up by .children.

@mitsuhiko

This comment has been minimized.

Member

mitsuhiko commented Dec 26, 2015

This is implemented now.

@mitsuhiko mitsuhiko closed this Dec 26, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment