I see you don't pass any parameters to your macro and I suspect you set up caching for your macro.
This means it will execute the first request to the macro and cache it. All other calls to the macro will render the cached result.
Probably you will also get the value of the querystring "id" inside the macro code.
If you set up your macro with a "id" parameter you can pass that in to your macro call.
This way the macro will execute for each different querystring value. But will return the result from cache if you call the page with the same querystring again.
Macro cache with url rewrite
I have a macro loaded by a page where url is rewritten:
If I access the page (via blog/123 or via post/?id=123) the macro is cached the first time, then it will be the same for all others pages. Example:
I'm embedding the macro with this code:
Is there any option to tell the macro to cache by id?
Hi Joe,
I see you don't pass any parameters to your macro and I suspect you set up caching for your macro.
This means it will execute the first request to the macro and cache it. All other calls to the macro will render the cached result.
Probably you will also get the value of the querystring "id" inside the macro code.
If you set up your macro with a "id" parameter you can pass that in to your macro call.
This way the macro will execute for each different querystring value. But will return the result from cache if you call the page with the same querystring again.
Makes sense ?
Dave
Thanks to your suggestion I've solved the problem. Here the solution for future reference:
Embed the macro passing the querystring parameter, like this:
@Umbraco.RenderMacro("Post", new { postId = Request["id"] }
)Check the "cache by page" option in macro
Nice you were able to solve it.
Don't forge to mark the post as solved so others can find it as well.
Dave
is working on a reply...