Can I use IContentFinder to route mutiple URLs to one node and pass paramters?

I am wondering if I can use an IContentFinder to parse /news/YEAR/MONTH/ and route it to a specific ID but pass in the values of YEAR and MONTH as parameters for that document to act on? I know the IContentFindercan do the routing just not sure if it can pass parameters or not.

Hi @Eaglef90

I don’t believe you can, as you find your content based on your own logic and then call:

contentRequest.SetPublishedContent(content);

Umbraco then uses that content for processing the request.

See more details here:

You could pass additional details along HttpContext.Items in your content finder though:

var http = _httpContextAccessor.HttpContext;
http.Items["archiveYear"] = int.Parse(...);
http.Items["archiveMonth"] = int.Parse(...);

Justin

Another option would be to use a IVirtualPageController, which can then create your own model to pass to a template.

Hi Matthew :waving_hand:

I know you’re specifically asking about being able to use IContentFinder for this - but I’ve solved this particular situation multiple times with a redirect (i.e. a “rewrite”), so just in case you wanted another approach:

The one page that handles the rendering takes the query string params year and month, e.g.: /news/?year=2026&month=08 and renders the corresponding item(s).

A redirect handles this (RegEx): \/news\/(\d{4})\/(\d{2})\/? and does an internal redirect (aka “rewrite”) to something like this: /news/?year=$1&month=$2 — that way the browser URL stays on /news/2026/08/ while Umbraco sees the /news/?year=... version.

Granted, it doesn’t handle the “News” node being renamed but it’s a viable option that works surprisingly well.

/Chriztian

I don’t want to use a redirect though. The URLs with /year/month are valid, they just need to serve up the same page that core /news/ does but the backend pulls different articles to display.

IVirtualPageController looks to be more what I am looking for but I did not dig to far into that. Found a few bugs in a package I am developing and have been side tracked fixign them