Skip to main content
Notice removed Authoritative reference needed by CommunityBot
Bounty Ended with Chris4783's answer chosen by CommunityBot
Tweeted twitter.com/StackDrupal/status/1589815273640501248
Rephrase title
Link
leymannx
  • 18.8k
  • 6
  • 72
  • 126

Sort view result How can I sort results by Taxonomy term name extracted from urlcontextual filter value?

Notice added Authoritative reference needed by tanbog
Bounty Started worth 50 reputation by tanbog
Source Link
tanbog
  • 1.3k
  • 11
  • 35

Sort view result by Taxonomy term name extracted from url

I have a set of pages that use path information to - amongst other things - create view of relevent news articles.

eg:

mysite.com/city-service
mysite.com/country-service
etc

I have an existing view that uses a contextual filter to extract the relevant portion of the URL and then look up relevant news articles that are tagged with an organisation tag that maps to each service.

This works great, but I have been asked to change the view to the following behavior:

  1. Show ALL recent news articles
  2. Sort the news articles so the relevant (and recent) organisation tagged news is at the top

I am not allowed to radically redesign the page or workflow for staff - eg manually tag all news articles - so the only place I can get the taxonomy term name for the sort is the url.

How can I sort view results based on a taxonomy term name that takes a parameter from the page url?