I'm trying to implement pagination into my website and as it stands this is breaking because of how im formatting my tags.
Currently I have a textstring where you can enter multiple tags which are comma spaces. (For example: Tag 1, Tag 2, Tag 3, Tag 4)
These are then broken up and added to a list using the code below:
string[] tags = item.GetPropertyValue<string>("blogTags").ToString().Split(',');
List<string> tagList = new List<string>();
foreach(var tagItem in tags)
{
tagList.Add(tagItem);
}
if(tagList.Contains(urlTag))
{
@blogInner(item);
}
The variable urlTag is a URL request (code below)
var urlTag = Request["tag"];
This enables tags to be searched using the URL.
Basically I need a query that will only select the blog posts that have the tag of the variable urlTag straight off the bat instead having all the blog posts then filtering out like it currently does.
I had the same issue for the date search but I now have this query. So something like this should work, if its possible of course.
var dateBlogs = Model.Children().Where(x => x.GetPropertyValue<DateTime>("blogDate").ToString("d-MMM-yyyy").ToLower() == urlDate.ToLower());
Complex Query for Multiple Tags
Hi All,
I'm trying to implement pagination into my website and as it stands this is breaking because of how im formatting my tags.
Currently I have a textstring where you can enter multiple tags which are comma spaces. (For example: Tag 1, Tag 2, Tag 3, Tag 4)
These are then broken up and added to a list using the code below:
The variable urlTag is a URL request (code below)
This enables tags to be searched using the URL.
Basically I need a query that will only select the blog posts that have the tag of the variable urlTag straight off the bat instead having all the blog posts then filtering out like it currently does.
I had the same issue for the date search but I now have this query. So something like this should work, if its possible of course.
Thanks, Lewis
Hi Lewis
Will this code work for you?
Alex
I recommend using the Examine. I'll share a code I used to make my blog http://www.marciogoularte.com.br
I created a document type blog and I used renderMvcController to do the search.
Thanks, Alex and Marcio,
I went for Alex's answer as it was the most simple to implement.
Thanks, Lewis
is working on a reply...