I havent tried language variants yet, but according to a question i asked on the U8 webinar it works automatically by just using @Model.Name - The language variant system takes care of it out of the box.
In Umbraco 8 I think it is a little confusing, the IntelliSense no longer display
conentItem.Value<t> just conentItem.Value.
Just to answer your question, it would simply be IPublishedContent.Value and yes the optional IPublishedContent.Value<T> also works. IPublishedContent being your content item.
Now another thing I do find confusing is the optionlal ValueFor or ValueFor<T>, what is the difference? Could someone perhaps clear that up for us.
Rendering standard properties in 8
How do we render standard properties in 8. The built in
Doesnt work - it renders nothing...
Try
@Umbraco.Field("pageName")
instead.You can use the insert button in the template editor too:
@Sebastiaan I think
.Field()
has been removed in v8 onUmbracoHelper
so we don't have these different methods to extract property values.So it should just be the following, which inserting a field value also output.
@Model.Value("property")
@Claus is
pageName
a custom property? The node name can be accessed viaModel.Name
.Also ensure the page inherits from
Umbraco.Web.Mvc.UmbracoViewPage
./Bjarne
Ok just to be clear - i used the built in "Insert value" button. it inserts
wich returns nothing - The same goes for the others like @Model.Value("createDate"), @Model.Value("pageID") and so on.
Bjarne is right. @Umbraco.Field("pageName") doesnt work at all anymore, it throws errors.
@Model.Name works, thanks Bjarne.
So to sum it up, the built in "inset value" is broken when inserting standard system values.
Ah yeah, looks like this is being updated for the next version of 8 already, sorry to mislead you ;-)
I see, you can however access these properties using the properties on
IPublishedContent
model, e.g.@Model.Id
(pageID)`@Model.Name
(pageName)@Model.CreateDate
(createDate)... and how do you output the different language versions?
Say your main language is English and you were on the Welsh version of the page, how do you output the Welsh page title?
(I hope you don't mind me hijacking your question, Claushingebjerg).
I havent tried language variants yet, but according to a question i asked on the U8 webinar it works automatically by just using @Model.Name - The language variant system takes care of it out of the box.
I could be wrong...
Many thanks...
I think this should answer my question.
https://our.umbraco.com/Documentation/Getting-Started/Design/Rendering-Content/
Thanks
Muiris
This was not fixed in 8.01...
I've found these work in a
PartialViewMacroPage
For a custom property, try
... and for core doctype properties, try
... and for CheckboxList, you can assign a variable with the following value.
However, I got really stuck trying to get PreValues in the Partial View.
Thanks
Muiris
The type of the return value has changed.
Where we'd do this in v7
@Model.Content.GetPropertyValue<string>("property", "").Split(',')
It's now this in v8
@Model.Content.Value<string[]>("property")
In Umbraco 8 I think it is a little confusing, the IntelliSense no longer display
conentItem.Value<t>
justconentItem.Value
.Just to answer your question, it would simply be
IPublishedContent.Value
and yes the optionalIPublishedContent.Value<T>
also works. IPublishedContent being your content item.Now another thing I do find confusing is the optionlal
ValueFor
orValueFor<T>
, what is the difference? Could someone perhaps clear that up for us.is working on a reply...