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

[RFE] Viewless content types #2149

Closed
tobias2k opened this issue Nov 11, 2014 · 16 comments
Closed

[RFE] Viewless content types #2149

tobias2k opened this issue Nov 11, 2014 · 16 comments
Labels
enhancement RFC Request For Comments

Comments

@tobias2k
Copy link
Contributor

Proposal: add a property viewless to contenttypes.yml (or, alternatively, allow explicitly setting the template properties to null - discuss!), which indicates that:

  • the contenttype is not associated with any template
  • the contenttype does not produce any frontend routes
  • there is no 'Preview' button in the backend for this contenttype
  • the contenttype does not appear in any search results or listings on the frontend

The purpose of such contenttypes is to provide manageable "auxiliary" content that can be referenced from other content records and templates (either through getContent / {% setcontent %}, or by means of Relationships), but doesn't make sense on its own. Popular examples include snippets of information that you may want to share between proper content records, but that don't deserve frontend pages of their own, such as contact addresses, content blocks for headers and footers, etc.

Technically, all that is required to do this is add the property, and check it in a few strategic places to block the things listed above.

Regarding naming, I propose the term viewless contenttypes; suggestions for a better name are extremely welcome.

@tobias2k tobias2k added the RFC Request For Comments label Nov 11, 2014
@GwendolenLynch
Copy link
Contributor

This has been on my wish list forever. I currently have hackish workarounds for it, but something simple and formal would be awesome!

@rixbeck
Copy link
Member

rixbeck commented Nov 11, 2014

+1 and other +1 for template:=null

@rossriley
Copy link
Contributor

I actually like the simplicity of setting the template to null but then I guess that can be a bit magic in that it does much more than just not have a template.

So my vote would be for an explicit setting (although by convention it might be nice to set the template to null too) not sure the best name for it, viewless and viewable seem a bit awkward.

@xiaohutai
Copy link
Member

Same as @GawainLynch . I usually call them Blocks, then use {% setcontent block = 'blocks/some-item' %}. Something like, https://snippets.bolt.cm/s/5vkxt

@tobias2k
Copy link
Contributor Author

@rossriley that was pretty much exactly my line of thought - template = null is elegant but magical, viewless = true is obvious but redundant.

@bobdenotter
Copy link
Member

👍 for viewless: true, but i could live with template: null too.

@rixbeck
Copy link
Member

rixbeck commented Nov 11, 2014

... and what happens if dummy user conf like this?

...
    template: list.twig
.. bla-bla ...
    viewless: true
...

Just because a contenttype record can be long enough and could be long distance between that rows to be able realize easily what's the problem with.

@GwendolenLynch
Copy link
Contributor

I would expect viewless: true to take precedence myself... 😕

@rarila
Copy link
Contributor

rarila commented Nov 11, 2014

👍

@rixbeck
Copy link
Member

rixbeck commented Nov 11, 2014

@GawainLynch it is of course. I was just meant about "Why my template doesn't gets run?" situations.

@GwendolenLynch
Copy link
Contributor

"Why my template doesn't gets run?" situations.

Thinking out loud, but there is an updated logging system that will hit the ground circa 2.1 and one thing I want to do it look at what we're logging and how that is relayed to the site admins... Maybe this is just something we can log?

@rixbeck
Copy link
Member

rixbeck commented Nov 11, 2014

@GawainLynch that's fine I think. Entry in log something like this Viewless config option takes precedence over template... ?

@GwendolenLynch
Copy link
Contributor

Works for me

@tobias2k
Copy link
Contributor Author

I was just meant about "Why my template doesn't gets run?" situations.

Well, that question would rather surface as "why does my content not show up at all?"

In that context, maybe it would be somewhat confusing to see the route disappear when you set the template to null, so maybe we should go with the explicit "viewless property" solution after all.

@bobdenotter
Copy link
Member

Ok, we will make it viewless: true

@GwendolenLynch
Copy link
Contributor

🍻

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

No branches or pull requests

7 participants