APIs & Integrations

AAsim4
Member

Sorting List of Team Members based on Surname

I have a blog listing page which features all my blog posts. Each blog post is basically a team member. The title of the blog post is the name of the team member.

What I want is that on the blog listing page, I sort the list of all blog posts based on their surname.

Previously I was doing something like this:

contents|sort(false, false, "name")

Now I want it to be something like this:

contents|sort(false, false, "name.split(' ')[1]")

 So for instance, I have two names:

Jon Snow, Cersie Lannister

 

The sorted order should be:

Cersie Lannister, Jon Snow

 

As L appears before S in the alphabet. 

How can this be achieved?

0 Upvotes
1 Reply 1
AAsim4
Member

Sorting List of Team Members based on Surname

@Jaycee_Lewis would appreciate it if you could help in regards to this. Thanks!

0 Upvotes