I have a view set up to function as a blog, and a contextual filter set up to filter by author of the blog post.
The point is to be able to click on the blog post author link and go to a page that lists all the blog posts by that person. This is facing anyone who visits the site, and any visitor (non-logged in) can view the blog listing of any of the authors.
The current set up is to have a Relationship
to the author
table, and filter by User: name
. Then when visiting a url /blog/author/John Smith
, you see all posts by John Smith. (I realise that's an invalid URL.)
The filter itself is working and the blog posts are being pulled through for all the authors, however, I'm having issues to transform spaces to dashes and to lowercase the URL.
When you visit /blog/author/John Smith
, you are redirected to /blog/author/John%20Smith
, and then the blog posts by John Smith are visible, but this isn't good enough for us in terms of URLs.
So instead of /blog/author/John%20Smith
, I need the URL to be /blog/author/john-smith
.
The problem is that the default checkboxes and options which work for taxonomy terms do not seem to work with Author names. Ticking transform spaces to dashes in URL
and using case in path: lower
does not affect the filter the way I want it to - it has no effect at all.
I'm considering creating a new field in the user entity and then using that to filter instead. Like
john-smith
for theJohn Smith
user. I'm not sure if that'll work, but I'll try it out right now.
The above has worked, and I do have the URL's I want and they query for the right items. I'm not sure if it's the cleanest solution though.