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

Build multiple layouts #1305

Closed
ir-g opened this issue Jul 14, 2013 · 16 comments
Closed

Build multiple layouts #1305

ir-g opened this issue Jul 14, 2013 · 16 comments

Comments

@ir-g
Copy link

ir-g commented Jul 14, 2013

I believe that it would be a helpful feature for Jekyll, to be able to generate multiple layouts for the same page.

E.G.
Layouts folder:

  • layout.html
  • layout_mobile.html
  • layout_xml.xml

Would then generate for each page:

  • page-path/page-name.html
  • page-path/page-name_mobile.html
  • page-path/page-name_xml.xml

This would help websites create fast static pages, for various devices.

@nicinabox
Copy link

Why not responsive?

@ir-g
Copy link
Author

ir-g commented Jul 14, 2013

Responsive is how I code, I was giving an example. My use for this was to make an XML copy of each page, such that I can make a PJAX-like system for my Jekyll site.(Instead of using a different header request, use a different file.)

I believe this could have many helpful uses, including accessibility, developing custom APIs for viewing content, and beta testing of themes.

@robwierzbowski
Copy link

+1 on this. I'd like to use multiple layouts to make parts of my content available as a json api.

@nicinabox
Copy link

I'm not specifically against this idea, but it seems like (and please correct me if I'm wrong) there are existing solutions for most of these problems.

@isaacrg That sounds a lot like Turbolinks. Wouldn't you want to be requesting HTML and not XML for that though?

@robwierzbowski Have you seen what healthcare.gov is doing? json for posts, json api

@robwierzbowski
Copy link

I have seen that, but I think it would be more flexible and better developer experience to parse the content through a layout to create xml / json / alternate html. I don't want to write a new ruby extension every time I'd like to create an alternate layout.

@ir-g
Copy link
Author

ir-g commented Jul 15, 2013

@robwierzbowski Definitely agree, I am aiming to be using Github Pages for building by site, thus want to avoid Ruby Extensions for safety.

@parkr
Copy link
Member

parkr commented Jul 16, 2013

With our current architecture, multiple layouts is absolutely impossible. We ask the page or post for its url, convert it, parse the liquid and place it in the (sometimes nested) layouts and write it to the URL it tells us about. Having multiple layouts means we'd need multiple URLs for one page or post which breaks the simplicity of jekyll. I'm 👎 on this. Reduce your content to something like a JSON api and load into various different formats as needed.

@parkr
Copy link
Member

parkr commented Jul 16, 2013

@mattr-

@robwierzbowski
Copy link

OK, no worries. I can see multiple urls for one page breaking pagination, etc.

Would making a single layout canonical and fully processed by Jekyll, and just generating the others, simplify some of your concerns?

@mattr-
Copy link
Member

mattr- commented Jul 17, 2013

I could see how this would be a useful feature to have. I'm afraid that it's a bit too complex for what we're trying to achieve with Jekyll though. Admittedly, we have a somewhat narrow focus on what we're going for and I'm afraid this doesn't fit into our vision for the project.

If you have any other suggestions for Jekyll, please do bring them to our attention with another new issue! We'll be happy to consider them.

@mattr- mattr- closed this as completed Jul 17, 2013
@kvz
Copy link

kvz commented Aug 9, 2014

I have a usecase where I want Jekyll to generate email-proof html via a layout based on http://htmlemailboilerplate.com/, that i'll apply on a few blog posts. Found this plugin https://github.com/saclark/jekyll-multipost. Haven't tried it yet but thought it worth sharing

@dwhogg
Copy link

dwhogg commented Sep 11, 2014

Another use case for being able to support multiple layouts for the same page:

Content (such as help files) related to a hybrid web app. Depending on if the content is viewed from within a hybrid packaged app (Android, iOS, or Chrome web app for example) vs simply viewed directly through a browser - may want differences (remove menu items etc when viewed in packaged app).

@media css directives are no help here since the same device may be used either in a packaged app environment or directly through the browser.

I realize the feature request has been deemed outside of scope for jekyll - but just hoping :)

@kleinfreund
Copy link

@dwhogg This is really outside the scope of Jekyll. This is the job of CSS and/or JavaScript.

@dwhogg
Copy link

dwhogg commented Sep 11, 2014

@kleinfreund Thanks. Not clear to me how css/js could solve this since css media queries can't be used to distinguish the use cases. Suggestions welcome...

@kleinfreund
Copy link

Indeed, CSS media queries are not capable of doing so. Also I don't know about feature detection via JavaScript. But these are technologies witch atleast theoretically could be capable of doing what you want.

Jekyll is not. Jekyll is not interacting with the client side. It's built before and the user will only ever interact with a static site built with Jekyll.

@dwhogg
Copy link

dwhogg commented Sep 12, 2014

Totally fine with saying this is outside of the scope for jekyll - however what I am hoping for is certainly do-able for a static site. In fact, my (ugly) workaround for now is to run a script that copies my help collection files to a "helpapp" collection and then changes the YAML front matter in each file from "layout: help" to "layout: helpapp" just before doing a final build and publishing to the server.

@timwis timwis mentioned this issue Apr 9, 2016
@jekyll jekyll locked and limited conversation to collaborators Feb 27, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

9 participants