Shared Content in Page Templates
Hi Team Telerik,
How do we add shared content to Page Templates?
Also, don't forget to vote for the issue in PITS (lot of good that does anyway, it's already the top voted item by 23 ahead of #2) :/
Although it initially appears that solutions works. When you actually try to edit the shared content, the changes are NOT reflected on all the templates using that shared content. Does anybody else have a workaround or suggestion?
Thanks for the reply Tim,
I tried that. I have 2 templates that are using shared content blocks. When I edit a shared content block on one template and publish it will work for that template. However, the changes are not reflected on the other template that is using that shared content block, even if I republish.
That's sounds right and it's the major downfall of using this method. You'll need to publish each template that you're using the content block on.
Resurrecting this thread and I'll summon Jochem and Steve to argue with me. ;)
We have templates, and templates can inherit from other templates. So, for example, if you had a footer that was common to the entire site you could put that into a template and then create numerous sub-templates based off that original template. This essentially creates "shared content" - content that is shared amongst numerous templates and the entire website.
With 124 votes this is obviously a big issue (and perhaps that is reason enough), but I'd love to understand a bit more about the use cases everyone is looking to tackle with shared content.
Telerik | Sitefinity CMS
Well there's not much of an argument, you're right its a big issue and Tim's right that its 'broken' :)
1. Create a masterpage called 'parent' and put a content block in the footer and a menu in the header.
2. Create 5 masterpages which inherit from 'parent' and name them 1-5 and put a content block in the body to identify them.
3. Create 6 pages, each one utilizing one of the templates.
4. browse all 6 pages.
Everything works as you'd expect it, the footer content block appears on all the pages correctly.
Now edit the 'parent' masterpage and change the content block and hit publish.
If you browse all the pages again, you'll see 5 pages still showing the old content, and just one (the one utilizing the parent masterpage) showing the new content. Meaning I'd have to re-open and re-publish every inherited masterpage to get the changes reflected.
At least that was the issue right up until 5.1.3270 where I last tried it :) Nice sneaky fix there :) But unfortunately .Master changes aren't reflected upon the inherited ones still.
But that's only one third of the problem, the second part of the problem lies in the content-abilities of content blocks.
Although both are html-field only by design their functionality is different.
A template content block, is sort of a 'strict' html-field, where it strips out spans and only stores xhtml valid markup.
Where as a page or shared content-block can store html5 valid markup and doesn't strip out spans.
(FYI: The ability to set which contentfilters apply to a contentblock is broken atm)
Why is this important?
Let's take an actual example of displaying a company's address. Since its 2012 we want to mark-up our address with some microdata.
<div itemscope itemtype="schema.org/Organization">
<span itemprop="name">Google.org (GOOG)</span>
<div itemprop="address" itemscope itemtype="schema.org/PostalAddress">
<span itemprop="streetAddress">38 avenue de l'Opera</span>
<span itemprop="addressLocality">Paris, France</span>
The thing is, you simply can't. Copy-paste that on a template editor and it won't store it and strips out in a weird fashion.
Truthfully, the only idiotic way to re-use a marked-up address is to write a usercontrol with that as the markup, save that as a widget and then drag-n-drop it on the templates.
Here's a quote from a support ticket:
"...but the instance of HtmlField in page tempaltes is not affected by the mapped template it will always remain the default html field in sitefinity. This is behaviour done by design as the html field in templates shouldn`t be customized "
Meaning by design, we're working with a CMS system that forces us to adhere to a 1999 (yes more than a decade ago and in the previous century) standard.
And the third issue with inherited templates vs shared content is perhaps not so much technical as it is permission related.
Sometimes you simply don't want to allow certain users to have template editing capabilities.
But when they should be able to edit a certain re-appearing content block say some quote/announcement/banner you have to compromise.
Either you take the risk and hope every day that a novice user won't remove or accidently drop something on a template.
Or you don't take the risk and force the client to drag-n-drop that content block on every single page (s)he creates.
I also like to push this issue. I won't go back to the times where we were promised that it would be there after a few releases...!?!
I used this option all the time in the 3.7 sites, and also my experience with clients is that they like this option.
Some content you just have to copy/paste from your HTML into your templates. It's not worth creating widgets for that (as Jochem mentioned).
So, really hope this will be in the next version as you would make much clients happy.
In the meantime if someone needs a simple workaround, check this blogpost:
As it would maybe help to make life easier :)
I'll join the argument "For" shared content blocks on templates, but from a different angle. One that should always be utmost in our thoughts: Our large corporate clients.
For these clients, we provide a very locked down experience with permissions, workflows, access restrictions very strict.
Giving users the ability to change Page Templates is generally not something that we do, as they can break the whole site in this way.
But sometimes we want to allow them to change one small section (ContentBlock) on the template.
Right now, we can't (easily), as they can't see "Design -> Page Templates" due to permissions.
However, we can easily allow then to see "Content -> Content Blocks" where they could interact with the shared content block, and therefore update only that part of the template we allow them to.
Hope that makes sense, and adds another angle as to why we should allow shared content blocks on templates.
Hey everyone, Sitefinity 5.3 adds support for shared content blocks in page templates. Feel free to review the release notes.