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

Alternative representation #2897

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

A----
Copy link
Contributor

@A---- A---- commented Apr 27, 2020

I've been fiddling with the idea for a while now. In many cases, I need to have different representations of the same page. There are ways (namely headers) but those have limitations. They does not use the same pipeline as page content (so, no plugins).

Here comes what I called Alternative Representations. It's one or more other markdown files next to the usual one. Its use cases are:

  • Summaries but on steroïds
  • Other kind-of-similar use-cases : having different representation of the page when displayed on the home page / search results page / …
  • Complex content in classic or modular pages

Here's an super-simple illustration of the last use case. I need a two-columns page (or page module). Additionnally, I want to use the image-captions plugins. Here's what I get if I use a header:

image

Now, using the alternative representation:

image

Content pipeline (including plugins) processes the alternative MD file, caption is displayed.

My folder looks like this:
image

In my left-column template, I now use this:

{{ page.alternativeRepresentation('side-content').content | raw }}

As of now, implementation might have unexpected results in some cases (namely multi-language sites) and I may need some guidance there.

@mahagr
Copy link
Member

mahagr commented Apr 27, 2020

Well, we had the same idea as I've implemented one to flex already. In there you can have an unlimited number of layouts for both collections and objects.

It should already kind of work for the Flex Pages as well, just define the layouts and use the render() method. Unfortunately, as it is now, all the layouts are shared between every page type... So that part may still need some work.

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.

None yet

2 participants