Closed telljimmy closed 5 years ago
Hi @telljimmy Are you sure you have created the Article Content property as mentioned in this image: And can you make sure that you have the same field "alias" (the pad lock text).
Sorry for the late reply. I used Article Content instead of Article Contents. But its the same in both document type and in the Macro Partial. So hope it should have worked. images below. Thanks
the error is \Views\MacroPartials\listArticles.cshtml(23): error CS1061: 'Umbraco.Core.Models.IPublishedContent' does not contain a definition for 'ArticleContent' and no extension method 'ArticleContent' accepting a first argument of type 'Umbraco.Core.Models.IPublishedContent' could be found (are you missing a using directive or an assembly reference?)" string
To the team: It has to do with the modelsbuilder. We should take some time to validate whether that this tutorials has issues with the new modelsbuilder features.
Hi @telljimmy
I am sure that if you do @(Umbraco.Truncate(item.GetPropertyValue<string>("articleContent"), 100)
... it will work.
I also hit this issue when following the tutorial and using the sample code, using GetPropertyValue and casting to a string resolves this. I'm running v7.12.3
Also getting same error here.
I think you might be using the dynamic model (Model.Content) you will need to use the typed model (Model.TypedContent) for this extension method to work
@Jeavon yeah i think you are right, For anyone who's getting the same problem, try below
@Umbraco.Truncate(@Umbraco.Field(item, "articleContents"), 100)
I have updated the sample to
@(Umbraco.Truncate(item.GetPropertyValue<string>("articleContent"), 100)
Thanks for reporting the issue, will close it now 🙂
The last part of this page shows sample for showing first 100 characters of an article (Fig 42). This is throwing an error saying @item.ArticleContents is not found.
This is the page with issues: https://github.com/umbraco/UmbracoDocs/edit/master/Tutorials/Creating-Basic-Site/Articles-Parent-and-Article-Items.md