Hello everyone. So, I'm in a project and my company wants me to use Umbraco as the CMS. I'm familiar with how you render partials, I've done it before.
So here's the idea. We have a website which has very distinguished blocks in the design. So for example we have something like this
Container A
Container B
Container C
What I want to do in Umbraco is be able to let the client decide in which order they want them. E.g.
Container B
Container A
Container C
Can this be done? If so, what am I supposed to use? Umbraco Partial View Macros?
I was thinking of having a list of some sort with numbers in Umbraco to let them decide which to render first, but I have no clue if this can be done. I don't need something specific, just to point me towards a way (if it's actually possible).
It's totally doable with Umbraco, please have a closer look at packages that allow you to do blocks Nested Content(which is part of the Core now) and Stacked Content:
The main question about containers is - will you use containers on the
page level or should they be selectable from few pages?
Both if possible. The main goal is to have Container A, B etc able to be used in its original page AND in other pages in different rows each time. E.g.
index.html:
Container A
Container B
Container C
being able to do something like :
Container B
Container A
Container C
but without changing the order of let's say our-products.html:
Container D
Container A
Container E
I hope it makes sense. Is that doable? We may not end up doing that after all, but you never know. Also, thanks for your response. I appreciate it.
Harry, it's doable, you have to put page related containers content to nested content property editor and site related blocks to some folder, and add picker to each page, where you will be able yo pick blocks from that folder in order that you need on this page.
So, it's VERY neat. I've done what I wanted and I'd like to show you some results. Very cool looking and the most flexible thing I've ever seen in Umbraco so far. This is how I did it:
@foreach (var item in Model.GetPropertyValue<IEnumerable<IPublishedContent>>("yourNestedContentCollection"))
{
//the partial view name part is because I'm using the convention _PartialView.cshtml
var partialViewName = "_" + item.DocumentTypeAlias;
@Html.Partial(partialViewName, item)
}
What this lil line of code does is it 'connects' the partial name with the Alias of the Document type I want. As long as the partial name is the same as the document type, the loop will render it once I have it in nested content.
This way, I literally cut the page in 6 humongous containers that can be reordered by the client by dragging and dropping. Inside of these humongous containers I have more nested content (content blocks) that do the same thing.
This is a playground for the client. They just populate content once per page and then they can rearrange it by dragging and dropping everything.
This is how it looks in Umbraco:
Wherever you see yellow lines are the titles. It's pretty cool and makes for a really flexible layout without breaking.
A big thanks to Marc Goodson and Alex Skrypnyk for their very valuable help.
Modularizing Umbraco partials
Hello everyone. So, I'm in a project and my company wants me to use Umbraco as the CMS. I'm familiar with how you render partials, I've done it before.
So here's the idea. We have a website which has very distinguished blocks in the design. So for example we have something like this
Container A Container B Container C
What I want to do in Umbraco is be able to let the client decide in which order they want them. E.g.
Container B Container A Container C
Can this be done? If so, what am I supposed to use? Umbraco Partial View Macros?
I was thinking of having a list of some sort with numbers in Umbraco to let them decide which to render first, but I have no clue if this can be done. I don't need something specific, just to point me towards a way (if it's actually possible).
Thanks in advance.
Hi Harry
It's totally doable with Umbraco, please have a closer look at packages that allow you to do blocks Nested Content(which is part of the Core now) and Stacked Content:
https://our.umbraco.org/projects/backoffice-extensions/nested-content/
https://our.umbraco.org/projects/backoffice-extensions/stacked-content/
The main question about containers is - will you use containers on the page level or should they be selectable from few pages?
Thanks,
Alex
Both if possible. The main goal is to have Container A, B etc able to be used in its original page AND in other pages in different rows each time. E.g.
index.html:
Container A Container B Container C
being able to do something like :
but without changing the order of let's say our-products.html:
I hope it makes sense. Is that doable? We may not end up doing that after all, but you never know. Also, thanks for your response. I appreciate it.
Harry, it's doable, you have to put page related containers content to nested content property editor and site related blocks to some folder, and add picker to each page, where you will be able yo pick blocks from that folder in order that you need on this page.
Thanks,
Alex
Ah okay I figured that would be the case. Thanks a lot for the help.
You are welcome, Harry
Write how was it and share some results with us
Thanks,
Alex
So, it's VERY neat. I've done what I wanted and I'd like to show you some results. Very cool looking and the most flexible thing I've ever seen in Umbraco so far. This is how I did it:
What this lil line of code does is it 'connects' the partial name with the Alias of the Document type I want. As long as the partial name is the same as the document type, the loop will render it once I have it in nested content.
This way, I literally cut the page in 6 humongous containers that can be reordered by the client by dragging and dropping. Inside of these humongous containers I have more nested content (content blocks) that do the same thing.
This is a playground for the client. They just populate content once per page and then they can rearrange it by dragging and dropping everything.
This is how it looks in Umbraco:
Wherever you see yellow lines are the titles. It's pretty cool and makes for a really flexible layout without breaking.
A big thanks to Marc Goodson and Alex Skrypnyk for their very valuable help.
is working on a reply...