I don't think this approach will work in our casse, tough. We render a lot of different macros on every page as the backoffice-users can pick which modules to show on each page.
Now we have added some heavy, slow loading modules and we need them to be asynchronously loaded or else the website takes forever to load.
Only other approach I can think of, is an WebApi and loading the data with JS. But that will take a lot of re-writing.
Render macro async
Hi,
Does anyone know of a way to render an umbraco-macro asynchronously?
Something like this: https://blog.michaelckennedy.net/2012/11/13/improve-perceived-performance-of-asp-net-mvc-websites-with-async-partialviews/
but with a macro instead?
Comment author was deleted
You could add an alt template that just has the macro on it and then fetch that async...
So simple steps would be (say that you have a news macro you want to fetch in that way).
Create a new template (that doesn't inherit from your master site design but is blank), say this new one is called onlyNews
Drop the news macro on that template
Using altTemplates you should now be able to render that template on any page by manipulating the query string
Append ?altTemplate=onlyNews to any page you wish
So you'll only now need to fetch the result from that in your js
Does this make sense?
Hi Tom,
If you want to use the AltTemp approach you can see this video from Umbraco TV about the subject.
https://umbraco.tv/videos/umbraco-v7/implementor/fundamentals/templating/alt-template/
/Dennis
Thanks for the answers!
I don't think this approach will work in our casse, tough. We render a lot of different macros on every page as the backoffice-users can pick which modules to show on each page.
Now we have added some heavy, slow loading modules and we need them to be asynchronously loaded or else the website takes forever to load.
Only other approach I can think of, is an WebApi and loading the data with JS. But that will take a lot of re-writing.
Any ideas?
is working on a reply...