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

Support multiple templatized pages in a single URL #125

Closed
wants to merge 1 commit into from
Closed

Support multiple templatized pages in a single URL #125

wants to merge 1 commit into from

Conversation

isaac
Copy link
Contributor

@isaac isaac commented Jul 15, 2011

This is a rough patch that supports everything that we talked about in this issue: #82

  1. Multiple templatized pages in a single URL
  2. Prefer static pages over templatized pages
  3. Set liquid variables for all templatized pages

There are (at least) a few issues with this patch:

  1. Needs to be optimized, particularly for paths with no templatized pages
  2. Fails 4/18 of the render specs - this is because I am passing different arguments to site.pages.any_in

I don't expect this to be merged, but hopefully this will serve as a good starting point for a discussion about how to implement these features.

Let me know what you think!

Cheers,
Isaac

@did
Copy link
Member

did commented Jul 19, 2011

Thanks Isaac ! That's a great starting point :-) I see how to optimize it.
That's definitively something we can work on over the summer.

@did
Copy link
Member

did commented Mar 27, 2012

hey guys, I've thought a lot about this one. Actually, I've came up recently with a intermediate approach: one level of templatized page BUT you can have as many sub pages of the templatized page as you want.

Example:
/projects/content_type_template/team <= the page displaying the guys who worked on any projects. In this page, you have access, of course, to the "project" variable. So "project.team" works great as long as you set up correctly your relationships between your Project and People collections (assuming you have these 2 collections).

This example was not possible before one of my commits in the 2.0.0.rc branch.

If we could avoid to have nested templatized pages, that'd be great ! Otherwise, we'll improve that for the 2.1.0 version.

Any thoughts ?

@isaac
Copy link
Contributor Author

isaac commented Mar 28, 2012

Hey Didier,

This intermediate approach may work for some people, but it won't work for the site I am currently maintaining: http://www.romandieformation.ch

Let me know if you would like some more information about how I structured this site to work around the lack of support for multiple templatized pages.

Cheers,
Isaac

@did
Copy link
Member

did commented Mar 29, 2012

sounds great @isaac. Let's chat on skype (dinedine31).
One last thing, your site looks really nice !

@did
Copy link
Member

did commented Mar 29, 2012

alright, I think I got something. let's forget about templatized pages, too complicated and not flexible enough. Let's introduce "wildcards" pages instead.

A couple of examples:

/products/:permalink
/points_of_sale/:pos_permalink/products/:product_permalink
/posts/archives/:year
/posts/archives/:year/:month
...etc

Which means that within the liquid template, our liquid context will contain the variables from the path. Based on the examples above:

/products/8go-iphone => {{ permalink }} will return '8go-iphone'
/posts/archives/2012/03 => {{ year }} will return 2012 and {{ month }} will return 03
and so on...

In order to keep the behaviour we had previously with the templatized page, we also will need a liquid tag to retrieve content entry in an easy way. something like this, assuming that we've got a "products" content type and that we visit the "/products/:permalink" page
{% find_product_from permalink %} => store the record inside the "product" variable which then can used in the template: {{ product.name }} {{ product.price }}, ...etc

I like this approach very much because pages are not tied anymore to the custom content types. Moreover, it allows us to have complex and nice urls like "/posts/archives/2012/03".

I'm looking forward to seeing what are your thoughts people ! Would it answer your needs @isaac ?

@isaac
Copy link
Contributor Author

isaac commented Mar 29, 2012

It sounds like this might work for my needs. A few questions:

  1. What do you think the UI might look like for adding a wildcard page?
  2. Would it still be possible to assign a content type to a wildcard page?
  3. Would it be possible to automatically assign the "product" variable without calling "find_product_from permalink" ?

@pauldacus
Copy link

HUGE +1 on this

@mariovisic
Copy link
Member

Thanks again for the pull request Isaac

But we've chosen to use wildcard pages to achieve the same sort of functionality, this feature should be available in the 2.1 release.

I'm going to close this one off, but thanks again.

Cheers
Mario

@mariovisic mariovisic closed this May 6, 2012
@nonfungibletunji
Copy link

how do you use the wildcard functionality in 2.1, we are finally here.

i have a blogroll page , that has a templatized page under it for the blogs content_type. The page correctly shows the blogs, but i would like to list three posts under each blog name, on the blogroll page. when a user clicks a links i want to:

    <li>{{post.title}} <a href="/blogroll/{{ blog._permalink }}/posts/{{ post._permalink }}">{{ post.title }}</a></li>

ie /blogroll/save-me/news-u-can-use,

any suggestions to make this work?

@menkel
Copy link
Contributor

menkel commented Oct 26, 2013

@stunjiturner I have the same problem

Have you found any solution?

@nonfungibletunji
Copy link

No. There is also a bug where if you have more than two level deep non templatized pages the URL path is incorrect.

S. Tunji Turner
Sightuary :: @sightuary

On Oct 26, 2013, at 7:36, Rousseau Clément [email protected] wrote:

@stunjiturner I have the same problem

Have you found any solution?


Reply to this email directly or view it on GitHub.

@menkel
Copy link
Contributor

menkel commented Oct 26, 2013

That's what I thought
I'll investigate

@nonfungibletunji
Copy link

check #811, seems some fixes in the engine

On Oct 26, 2013, at 11:12 AM, Rousseau Clément [email protected] wrote:

That's what I thought
I'll investigate


Reply to this email directly or view it on GitHub.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants