I'm returning the username as the second segment /blog/username
and then setting the username
var to craft.request.segment(2)
.
I'm looking to list a group of entries by that author (username). I've tried:
{% set blogPosts = craft.entries.section('blog').relatedTo(username) %}
I've also tried this:
{% set blogPosts = craft.entries.section('blog').relatedTo({ targetElement: username, field: 'author' })%}
Anyone have a way to list through entries related by author?