The object returned from a call to Umbraco.Field("seoKeywords") (which is a tags data type) is an IHtmlString, which contains the string "System.String[]" rather than an actual array of strings.
What is the solution for this?
EDIT: I was able to extract the tag datatype value using a strongly typed view and the following code:
var tags = Model.Content.SeoKeywords.ToArray();
but I'm still confused as to why the Umbraco.Field method doesn't work
MORE EDITS: Further testing using the CurrentPage object proves that I can get the tag datatype value using the following code:
string[] tags = CurrentPage.seoKeywords;
I have exactly the same issue. I had a very handy XSLT script in a V6 site which now doesn't work. Snipertags was great but that now doesn't work.
So I tried the Razor example as Jeremy has done and I get the same "System.String[]"
Has someone broken V7.7.6 in the name of progress?
Does anyone have an example of built in Tags actually working in a late version 7??
Tags not working
Using tags property and wanted to render it. It is giving back "System.String[]".
Please help me out.
Hi Nso
What wrong with tags rendering you showed?
Thanks,
Alex
If it is returning a string array, you would need something like this instead...
@if (@Model.HasProperty("tags")) { string[] tagsList = Model.tags;
}
This is an issue for me in 7.7.3
The object returned from a call to Umbraco.Field("seoKeywords") (which is a tags data type) is an IHtmlString, which contains the string "System.String[]" rather than an actual array of strings.
What is the solution for this?
EDIT: I was able to extract the tag datatype value using a strongly typed view and the following code: var tags = Model.Content.SeoKeywords.ToArray(); but I'm still confused as to why the Umbraco.Field method doesn't work
MORE EDITS: Further testing using the CurrentPage object proves that I can get the tag datatype value using the following code: string[] tags = CurrentPage.seoKeywords;
I have exactly the same issue. I had a very handy XSLT script in a V6 site which now doesn't work. Snipertags was great but that now doesn't work. So I tried the Razor example as Jeremy has done and I get the same "System.String[]" Has someone broken V7.7.6 in the name of progress?
Does anyone have an example of built in Tags actually working in a late version 7??
It isn't fixed so break it?
You may use this syntax as below to get the tag array:
I have replaced the selector used, as shown on https://shermandigital.com/blog/display-umbraco-tags-on-razor-templates/ I replaced Sherman's
with
I replaced "tags" with my property name "pageTags" (Sherman uses "articleTags")
And to display the tags? The code from Sherman Digital works. Thanks Rajmond!
is working on a reply...