Skip to content
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

Allow for more complex Repeater PageViews #100

Open
allejo opened this issue May 6, 2019 · 0 comments
Open

Allow for more complex Repeater PageViews #100

allejo opened this issue May 6, 2019 · 0 comments
Labels
Feature: Request The feature does not exist and this is a formal request for it to be added RFC We need feedback on a topic
Milestone

Comments

@allejo
Copy link
Member

allejo commented May 6, 2019

Description Value
Status Draft
Target 0.2.1
Breaking Change No

This is a proposal for extending the Repeater PageView behavior to allow for more complex nesting of permalinks. This feature would also be the foundation for supporting pagination at stakx's core.

Summary

---
proj:
  - bzflag:
      proj: "bzflag/%category"
      category:
        - null
        - maps
        - plug-ins
  - jekyll:
      proj: "jekyll/%category"
      category:
        - projects
        - themes
  - libraries
  - stakx
  - web-design
permalink: /projects/%proj/
---

The following Front Matter would generate the following permalinks:

  • /projects/bzflag/
  • /projects/bzflag/plug-ins/
  • /projects/bzflag/projects/
  • /projects/jekyll/projects/
  • /projects/jekyll/themes/
  • /projects/libraries/
  • /projects/stakx/
  • /projects/web-design/

Twig Usage

In each instance of the Repeater PageView, this.iterators would take on the following values:

  • this.iterators = [ proj => 'bzflag', category => null ];
  • this.iterators = [ proj => 'bzflag', category => 'maps' ];
  • this.iterators = [ proj => 'bzflag', category => 'plug-ins' ];
  • this.iterators = [ proj => 'jekyll', category => 'projects' ];
  • this.iterators = [ proj => 'jekyll', category => 'themes' ];
  • this.iterators = [ proj => 'libraries' ];
  • this.iterators = [ proj => 'stakx' ];
  • this.iterators = [ proj => 'web-design' ];

Detailed Description

At the moment, value expansion only works with an array of strings. This behavior would allow for value expansion to work with associative arrays that allow for further scoped value expansion. When value expansion reaches the "bzflag" value, it will take the value proj and build the permalink off of that.

At this point, we'll have the permalink of /projects/bzflag/%category and because of the scoping, it will then proceed to expand the values of this permalink with the values of projects[0].bzflag.category and generate three permalinks.

  • /projects/bzflag/
  • /projects/bzflag/plug-ins/
  • /projects/bzflag/projects/

Pagination

So how would this specification work with pagination (#72)? Essentially, this would allow for stakx pagination to live at stakx's core with built-in features. Given a blog website, the arbitrary _ has no significant meaning in - _: and is just a way to trigger this special behavior of requiring an associative array versus a string.

These examples are what the FrontMatter would look like internally, the syntax for pagination would be that of #72.

pages:
  - _:
      pages: "%number"
      number:
        - null
        - page2
        - page3
        - page4
permalink: "/blog/%pages"

and given a "group by category" clause, the FrontMatter would look like this:

categories:
  - announcements:
      categories: "announcements/%page"
      page:
        - null
        - page2
        - page3
        - page4
  - unsorted:
      categories: "unsorted/%page"
      page:
        - null
        - page2
permalink: "/blog/category/%categories"
@allejo allejo added RFC We need feedback on a topic Feature: Request The feature does not exist and this is a formal request for it to be added labels May 6, 2019
@allejo allejo added this to the v0.2.1 milestone May 6, 2019
@allejo allejo modified the milestones: v0.2.1, v0.2.x Aug 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature: Request The feature does not exist and this is a formal request for it to be added RFC We need feedback on a topic
Projects
None yet
Development

No branches or pull requests

1 participant