-
-
Notifications
You must be signed in to change notification settings - Fork 9.9k
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
Comments
Why not responsive? |
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. |
+1 on this. I'd like to use multiple layouts to make parts of my content available as a json api. |
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 |
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. |
@robwierzbowski Definitely agree, I am aiming to be using Github Pages for building by site, thus want to avoid Ruby Extensions for safety. |
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. |
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? |
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. |
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 |
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 :) |
@dwhogg This is really outside the scope of Jekyll. This is the job of CSS and/or JavaScript. |
@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... |
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. |
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. |
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:
Would then generate for each page:
This would help websites create fast static pages, for various devices.
The text was updated successfully, but these errors were encountered: