I often end up with a rather large amount of macros and I am curious if I handle/implement them the best way. It particularly strikes me when it is the same document type that has a need for a large variety of macros.
The way I see it there are three methods of including a macro in a page.
Templates: You create a template for each macro. This is fine if you only have a few macros, but if you have many you end with a lot of templates that only contains a macro.
Rich Text Editor: Insert the macro in a Rich Text Editor. I never liked doing this. Especially because I have seen several content editors that just aren't comfortable with it. They end up deleting macros or not using the feature at all.
Macro Picker: Select the macro with the Macro Picker. This is actually quite a good alternative I think, but I have only seen it adopted by few people.
1. I took this approach when I first started developing with Umbraco. A few of my customers wanted more functionality, so ended up duplicating templates with the only change being the Macro alias (and properties).
2. I've never liked this approach. Macros in the RTE just doesn't site right with me - especially when trying to modify the values - just gets messy for me, and my customers always break them.
3. My favourite approach these days. The last several sites I have built have had minimal templates (usually 3: Master, Content Page and Homepage - in that nested order) ... and then use the excellent MacroPicker to add extra functionality to each Content page. Plus the UI of the MacroPicker makes it difficult for my customers to break it!
1. By templates do you mean MasterPages or do you mean XSLT Templates? On large sites I would refactor macro's down and then allow them to call XSLT templates to make them more flexible.
2. Agreed, there are some good times to allow editors to insert macro's. But in my experience they are few and far between.
3. Macro Picker - we sort of use this idea. I'll lay out an example below;
A website has a section which contains news articles (1 doctype, 1 template), a news article is related to media (a media relation on the doctype).
The 'new article' document type contains a tab called modules, modules has some UCP's (ultimate content pickers) which list out a folder which contains modules. Editors can picker 'modules' (which are essentially blocks on content) these 'modules' are then passed into a macro which reads the module ID and any content, selects the correct XSLT template and renders out a page.
I quickly made a ghastly video showing this, when its a bit quieter in the office I'll record something properly and maybe do some code examples.
How do you handle large numbers of macros?
Hi,
I often end up with a rather large amount of macros and I am curious if I handle/implement them the best way. It particularly strikes me when it is the same document type that has a need for a large variety of macros.
The way I see it there are three methods of including a macro in a page.
Any thoughts on the above?
Hi Bjørn,
1. I took this approach when I first started developing with Umbraco. A few of my customers wanted more functionality, so ended up duplicating templates with the only change being the Macro alias (and properties).
2. I've never liked this approach. Macros in the RTE just doesn't site right with me - especially when trying to modify the values - just gets messy for me, and my customers always break them.
3. My favourite approach these days. The last several sites I have built have had minimal templates (usually 3: Master, Content Page and Homepage - in that nested order) ... and then use the excellent MacroPicker to add extra functionality to each Content page. Plus the UI of the MacroPicker makes it difficult for my customers to break it!
Cheers, Lee.
1. By templates do you mean MasterPages or do you mean XSLT Templates? On large sites I would refactor macro's down and then allow them to call XSLT templates to make them more flexible.
2. Agreed, there are some good times to allow editors to insert macro's. But in my experience they are few and far between.
3. Macro Picker - we sort of use this idea. I'll lay out an example below;
A website has a section which contains news articles (1 doctype, 1 template), a news article is related to media (a media relation on the doctype).
The 'new article' document type contains a tab called modules, modules has some UCP's (ultimate content pickers) which list out a folder which contains modules. Editors can picker 'modules' (which are essentially blocks on content) these 'modules' are then passed into a macro which reads the module ID and any content, selects the correct XSLT template and renders out a page.
I quickly made a ghastly video showing this, when its a bit quieter in the office I'll record something properly and maybe do some code examples.
Video Link -> http://www.screencast.com/t/YjA2ZGU5NGUt
is working on a reply...