Wondering if there is an easy way to loop through all articles of a specific tag easily. For example I want to create a couple of custom category type pages where I have commentary on the subject and then a list of articles that I’ve written on the topic.
I would try something like this:
blog.articles.each do |article|
next unless article.tags.include?("my-tag")
# do stuff here...
end
or this
blog.articles.select{|a| a.tags.include?("my-tag") }.each do |article|
# do stuff here...
end
2 Likes
Perfect solution thank you, didn’t realize I could loop all articles on a page by page basis. Thanks!