My tag filter works and displays the project under it's tag without displaying any other tag. So now I wish create a "tag" or fixed href to show "all tags".
Still some issues, but we are getting there.
Seems that the all tags view is now showing only 3 projects from the tags and if you click on a tag button itself it does not show you anything with exception of the all tags button.
Amended the code again it's all in matching up the variable names (also I have move instantiating the tagList(tags) out of the foreach loop to bring it back into scope. Apologies - writing blind :-)
@item was a disctionaryItem (KeyValuePair)
I've amended the code on github so the item is not an IPublishedContent object (the value of a KeyValuePair)
Compiler Error Message: CS0030: Cannot convert type 'System.Collections.Generic.KeyValuePair<int,Umbraco.Core.Models.IPublishedContent>' to 'System.Collections.Generic.KeyValuePair<string,Umbraco.Core.Models.IPublishedContent>'
On:
Line 84:
Line 85: @* Start picture content *@
Line 86: @foreach (KeyValuePair<string,IPublishedContent> kvp in items.OrderByDescending(i => i.Value.CreateDate))
Line 87: {
Line 88: var item = kvp.Value;
2/2 Umbraco tags filter out multiple tags that lead to the same page
First topic:
Hi all,
So I have my tags up and running for my site and have multiple tags that lead to the same page.
Example: a project page that talks about a headphone amplifier has the tags "OTL, headphone amplifier, tubes, 12AU7-6CG7, ..." listed as tags.
URL: https://www.don-zalmrol.be/projects/headphone-amplifier/
My tag filter works and displays the project under it's tag without displaying any other tag. So now I wish create a "tag" or fixed href to show "all tags".
Tag page URL : https://www.don-zalmrol.be/tags?tag=12AU7-6CG7
In a way this works, but it displays the project multiple times because of the multiple tags in my projects.
So now I am looking for a way to only display 1 project even if it has more then 1 tag.
You can see this yourself if you go to the all tags page I created: https://www.don-zalmrol.be/tags?tag=all
You will see everything displayed nicely, but the project(s) appear multiple times because it has more then 1 tag...
Any ideas or tips?
Thx!
*Last topic and continuation *
GitHub link = https://github.com/DonZalmrol/Umbraco
Hi Jamie,
Still some issues, but we are getting there. Seems that the all tags view is now showing only 3 projects from the tags and if you click on a tag button itself it does not show you anything with exception of the all tags button.
Back with you now - let me take a quick look
Amended the code again it's all in matching up the variable names (also I have move instantiating the tagList(tags) out of the foreach loop to bring it back into scope. Apologies - writing blind :-)
No prob, I understand :)
Getting close! It is fetching projects from my IT Blog but not all of them and nothing from the projects blog.
Funny thing is that this if-statement works and lists all the IDs without any issues. Even the duplicates (as nothing filters them out)
When you then list the output of :
You only get 3 items back.
So it seems that this command filters a bit too much.
Could it be that it adds all the fetched IDs together and then filter the duplicates out e.g.
11031104110611061095110510951119111811171099
Resulting in -> 1031041061061095105109519181709 and so on?
Ok maybe instead of a dictionary - change it to a list of IPublishedContent;
See if that works.
Swap out this line
For this
(Though really you could say)
Laurens - looking at the code again with a colleague change this line
to use items
the rest can return to how it was previously
(I'll update github so you can see.)
this line:
should be:
(updated the comment on github)
Updated Git
@item was a disctionaryItem (KeyValuePair) I've amended the code on github so the item is not an IPublishedContent object (the value of a KeyValuePair)
Hi Jamie, thx for you help so far!
Seems I get the following error now
On:
(I've updated Git :-) )
Laurens - is that all of projects displaying? It looks to be less than the list you had displaying earlier . . .
It works!
I have 11 projects on my personal site. So the output is now correct!
Many thanks Jamie! :)
Yay !
No problem - glad it now works. :-)
is working on a reply...