0:00
don't know
0:06
[Music]
0:09
so in this video I want to go over how
0:12
we can use the sort and filter features
0:14
inside of feeds now the this is the
0:19
feeds demo file I am using the total CMS
0:22
feed here
0:24
um that's just because I have some
0:25
decent data that I can filter out but it
0:28
doesn't really matter at all what your
0:30
feed is
0:31
um the sorting and filtering features
0:32
work on any sort of feeds databases RSS
0:35
CSS files CVS or CSV files the files
0:39
Pack videos I mean it doesn't matter you
0:41
can filter and sort on every feed
0:45
so let's dive in there are two different
0:48
kind of ways that we can sort and filter
0:51
and we're going to go over sorting first
0:54
but I do want to kind of go over the
0:56
nomenclature since they behave similarly
0:58
inside the main feedstack there is a
1:00
sort and filter function
1:03
however
1:04
um there may be the ability or time
1:07
where you want to do multiple filters or
1:09
multiple sorts
1:10
um so instead of adding multiple sort
1:12
and filter features here
1:15
um there is the ability to add a
1:17
pre-filter feed and pre-sort feed option
1:21
here so we can add pre-sort and
1:24
pre-filter now what's different with
1:27
these are I recommend that you add these
1:29
after all of your data feeds
1:32
okay because if you if you sort or
1:35
filter the data before your feed ever
1:37
gets added then nothing's gonna happen
1:40
Okay so you want to make sure that the
1:42
filters and the sorts happen after your
1:44
feed think of this as a logical
1:46
progression or importing our data we're
1:49
going to filter it and then we're going
1:50
to sort it okay you can have as many
1:53
filters and as many sorts as you want
1:56
now the if you also set the filter and
1:59
sorts inside of uh the main feedstack
2:02
they will happen after the pre-filters
2:05
okay so you don't have to have them here
2:09
um you can use just these if you like
2:12
um but for convenience if you only want
2:14
to do one sort or one filter it could be
2:16
useful to use them here okay the options
2:19
here and the options inside these Stacks
2:21
are identical so for the rest of this
2:23
demo I'm just going to show these child
2:26
Stacks just so it's kind of easier in
2:28
targeted example
2:30
um let's go over the sort
2:33
um so here we're going to provide by
2:36
default is no sort we want to sort so
2:39
essentially when you just do sort
2:40
um in most of these sort Fields you're
2:42
going to sort and you just provide the
2:44
actual field that you want to sort by
2:47
obviously if you Shuffle
2:49
um it's just going to shuffle the
2:50
records okay but all of these other ones
2:52
require that you actually Supply a field
2:55
name now how do you know that field name
2:58
um well hopefully if you're watching
2:59
this video you already know how to use
3:00
feeds and you can go ahead and say data
3:03
preview and if we preview in the browser
3:05
here
3:07
you'll see that we have all of the
3:09
fields that are listed that we can
3:11
actually filter by
3:13
Okay so
3:16
um in here I'm going to let's just sort
3:18
by title
3:21
I know this is a total CMS uh blog uh
3:25
feed so I'm going to go ahead and sort
3:27
by title
3:31
okay and here we go
3:33
um for some reason I have this odd one
3:35
that has numbers in it but after that
3:37
we'll notice that they are all sorted by
3:40
title
3:42
now we can also look at reverse sort so
3:45
we can reverse the sort and we preview
3:47
that we'll see that it then reverses the
3:51
sort
3:52
okay
3:54
now some other sort options here we have
3:56
natural sort and natural sort reverse
3:58
depending on what you want
4:01
um natural sort tends to do numbers
4:04
differently okay so if you if you're
4:07
ever sorted by a number you'll notice
4:09
that some com sometimes computers will
4:11
go one ten two three four you know so on
4:15
and so forth where natural sort will
4:17
actually then sort one two three four
4:19
five six seven eight nine ten eleven
4:22
twelve thirteen so natural start really
4:24
has to do with uh sorting better when
4:26
you have numbers involved if you know
4:29
you don't have numbers involved I do
4:31
recommend using sort because it's a
4:32
little less resource intensive not
4:35
anything noticeable but
4:37
um if you know you're not gonna have to
4:39
sort by natural number order
4:42
um definitely use sort versus natural
4:43
sort
4:46
okay now again if you wanted to sort by
4:48
title and then after you sort it by
4:50
title you wanted to sort by I don't know
4:52
the summary okay you can do that
4:56
so you can sort by title then sort by
4:59
summary and there we go
5:02
okay so it kind of gives us you know
5:04
multiple sort options here
5:07
so now let's dive into the filter
5:09
options and filter allows us to limit
5:12
the data essentially we're filtering out
5:14
data
5:15
so here I'm going to go ahead and now
5:18
there's two different types of filters
5:19
we can do a static filter
5:21
which says basically let's say I want to
5:24
show everything that has a tag of
5:29
Brazil's on there multiple times okay so
5:31
I'm going to go ahead and say I'm going
5:33
to do
5:34
um tags is Brazil
5:38
okay so
5:40
um it's static I only ever want to show
5:42
all blog posts that have a tag of Brazil
5:44
there we go
5:46
now if you notice in our rules we have a
5:48
lot of stuff so the default is equal to
5:51
so if a tag is equal to Brazil show it
5:54
but we can also do not equal to equal to
5:57
case insensitive not equal to case
6:00
insensitive starts with doesn't start
6:02
with so there's a lot of options here
6:04
contains doesn't contain if your
6:07
particular field is numbers do we do
6:09
less than or equal to
6:11
um if it's a Boolean field if it's true
6:13
or false is it empty is it not empty so
6:16
on and so forth there's also some date
6:18
logic in here if your field contains a
6:20
date so there's a lot of really powerful
6:23
logic in this to really give us a lot of
6:26
power okay so for example if I do
6:30
um starts with or actually let's do
6:32
contains okay contains Brazil
6:37
that's all that's still going to show us
6:38
both but watch if I do contains bra
6:43
okay it's still going to show these two
6:46
uh because both posts contain bra but if
6:49
I if I change this back to equal to so
6:52
tags equals to bra
6:55
it's going to show none because there
6:58
are no nothing that where the tag
7:00
exactly equals bra bra okay because it
7:04
was Brazil
7:06
so you can also do again starts with
7:08
ends with so on and so forth
7:10
so that's a static filter but what if we
7:13
wanted to dynamically filter our list
7:15
basically by like maybe passing some
7:17
functions to a URL
7:19
so we can go ahead and let's change this
7:21
to Dynamic URL filter
7:25
and what this does is we have the same
7:27
rules okay but now we only pass a URL
7:31
key so right now we're going to continue
7:34
to filter on the tags field
7:36
okay now let's preview
7:39
Now by default I haven't applied any
7:42
Dynamic filters to this so it's
7:43
displaying all blog posts
7:46
so let's go ahead and I'm going to go
7:48
ahead and add question mark tags
7:52
equal and let's do Brazil again
7:58
so there we go I've dynamically filtered
8:00
this by saying I want the tags to equal
8:03
Brazil so it's going to dynamically find
8:07
every post that the tag equals Brazil
8:11
again it still applies to this equal to
8:15
so for example and then if I change this
8:17
to go back to tags equals Google
8:21
there we go we show this particular one
8:24
that has Google as a tag now if I change
8:27
that to be something like g-o-g
8:30
it's going to return nothing because
8:33
there are no tags that have exactly that
8:36
but you can change that behavior if you
8:38
want right you can say contains
8:40
and if I preview this
8:42
let's just go back to this other one and
8:44
refresh that
8:45
there even though tags equals GOOG
8:50
because this contains that it will then
8:54
display the results so that's how we can
8:56
use Dynamic URL filters now
8:59
by default you can it will always ignore
9:02
a filter if it's not present
9:04
but
9:06
um if you uncheck this it's basically a
9:08
required option like you have to Define
9:10
that or else it's going to filter out
9:12
everything
9:13
so for example let's go ahead and turn
9:14
that checkbox off I'm going to refresh
9:18
and I don't have any filters to find
9:20
here so it's blank it's nothing right
9:23
because I'm not applying any filters
9:25
there are some use cases for that but I
9:28
think a majority of the time you're
9:29
going to want to make sure that that is
9:30
checked
9:32
and one other thing I should note is if
9:34
you wanted to support multiple filters
9:36
so if you wanted to do
9:38
um you know I want to filter by tag and
9:40
I'll potentially want to filter by
9:42
summary or something like that right
9:45
um You can go ahead and do that so let's
9:46
go ahead and do that now so let's say
9:48
and let's say summary contains and tag
9:51
is equal to
9:53
okay let's go ahead and preview that
9:56
so I'm going to do
9:58
um
9:59
we're going to do tags equals uh Brazil
10:03
again okay and let's say I want to make
10:07
sure my summary okay we're gonna do
10:10
um and summary equals
10:14
and we're going to do uh
10:17
uh uh plan right because it contains the
10:20
word plan in it for some reason this one
10:22
contains the word plan so there we go
10:24
and there we go so this is the only one
10:26
that can the summary contains the word
10:28
plan and we have a tag of Brazil right
10:31
so that's how we can kind of mix and
10:32
match filters again you don't require
10:35
them right so if I just did tags equals
10:37
Brazil I still get both so it's kind of
10:39
an optional thing
10:40
super powerful
10:43
um it's a it's a very powerful thing to
10:44
filter your data and really display now
10:47
if you don't obviously you don't want to
10:48
have users go ahead and you know typing
10:52
in the URLs so a really great way of
10:55
doing this is simply going and having
10:57
let's say a button okay or you know this
11:00
is the getting start the starter pack
11:01
button but we can go ahead and do a link
11:04
here so let's say I do
11:06
um
11:07
you know I can link to question mark
11:09
tags
11:12
um equals
11:14
um Brazil
11:16
okay and uh I can then uh change this
11:19
and say you know
11:22
uh Brazil posts
11:25
there we go um so if we preview this
11:28
I now have a button here that when I
11:30
click on it it filters by Brazil posts
11:32
so there's a lot of other ways you can
11:34
do this you can use like a foundation
11:36
six form with uses selects
11:39
um and so some more advanced options
11:42
um but you know this is a simple way of
11:43
just using a button
11:45
um and I think in in one of my feeds
11:47
videos I actually do um some select
11:49
boxes where I'm I'm actually you know
11:52
having a drop down menu to select buy
11:54
something and stuff like that
11:56
um I also did that on the made for
11:57
stacks.com website
11:58
um which actually uses feeds as well so
12:01
um check that out where I did an entire
12:03
tutorial on how I build uh that website
12:06
out so cool I hope you enjoy uh feeds
12:09
these are some great options for
12:11
pre-filtering and sorting super powerful
12:13
take care bye-bye
12:16
thank you
12:21
[Music]