Publishing two page templates for each content item in one edition

OK, I have read this thread and I think I understand the behavior of default templates, but I am looking for an answer to this specific situation:

I have 2 page templates for a single content type that I want to publish with one edition. I’d like those page templates to create 2 different files for each content item. What would be the recommended procedure for such an outcome?

By the way, if I leave the settings in the workbench for each of these templates as publish: default, I get both files, but the results of location.generate are unpredictable.

I usually specify what template to use with $rx.location.generate…

In general, to makes suret that the “default” template is the one that i want (so one which i don’t want to specify the template…ala a title link)…i make sure that the label/name of that template is alphabetically before the other template (ie. myPgFull and myPgFull_file2)…

Thanks for the help.

So, is that the official method? Does $rx.location.generate always choose the first alphabetical page template to in order to build the link?

I would not recommend more than 1 default template.

One of your two page template should be the “default” template, and the other one will be either “publish always” or “publish never” depending on how you want to publish it.

If the second template publishes for EVERY item of the content type, mark the template as “publish always”.

If the second template only publishes on selected items, mark the template as “publish never”, and then build a special content list that selects the items where this template publishes. Use the List Template Expander to make sure that this template publishes.

Of course, you will also need different location schemes for the two templates.

As has been pointed out in some previous threads, you cannot add a Publish Never template to a content list. You have to temporarily change it to “publish always”, add it to the content list, and then change it back to “publish never”.

Dave

No, you should not rely on this. Either be explicit about the template or use a dispatch template to figure out which template to link to.

Dave

Thanks, Dave.
I’m going to try the ‘Publish Always’ setting and see how that works for me.
I’ll report back with my findings.

Just to clarify what i was doing:
We have a content type that produces and html page as well as an xml page (RSS Feed)…so we had one content type with two templates that needs to be published per each site.

We have a generic “title link” snippet template that takes the “default” template for each content type and creates a link to this full page template (using $rx.location.generate without any specific full page template for obvious reasons…not all content types have the same full page template). Of course the problem became when I called the xml template some name that was alphabetically before the html page template…in which case, the above snippet would link to the XML page…not the desired behaviour (hence the solution with the name).

In another case, we allowed a file to be uploaded and published, but also wanted to have an html page (This was actually when i figured out the “solution”). The issue here was myBnContentType comes before myPgContentType (“Bn” and “Pg” was how i used to separate out the templates)…but since the above problem came into play, i had to call the binary template myPgContentTypeBn.

Of course in both the cases above i had created different location schemes…

In the third case in which we use the generic location scheme (so only one location scheme), produces two html pages and like the ones above, the one that i want to be the “default” page is called something that is listed before the other one (essentially the default page is an author page and the other template produces resources authored…)

Other thoughts:

  • Clearly wherever i want to reference the “secondary” template, i do so explicitly (ie. call $rx.location.generate with the template parameter)
  • What i can tell from the dispatch template (choosing a single template) will not help us in this matter as we need both published…
  • We have about 70 different sites currently (and those keep on growing)…so editing content lists is not a pleasurable task :)…we are using nt:base on those content lists to make them as generic as possible so adding another content list just for the content types to produce additional templates seems like a lot of overhead…unless of course the above method will not work in the future…

Not wanting to rely on radioboxes scattered in hundreds of templates, or pre-MacOSX-Apple-Menu-style alphabetical order hacks, we set up a dispatch template for each content type, and made that the default for that type on all sites. Conditional code in the bindings sets $sys.template to determine which actual template to use for assembly. Then we have one dispatch snippet tempate that does the same thing for snippets, which is even more useful because whenever an author adds an item to a slot, it stores which template to use. As we anticipate wanting to change which template is used in the future, a dispatch template is the only way to go. It also allows us to have multiple page styles (e.g. “full”, “simple”, “wap”) and have the dispatch snippet template call the correct page template, so that once a visitor to the web site switches from “full” to “simple” mode, any link they click will take them to the “simple” version, not back to the “full” version (which is the default.)

BTW, if you have got into a mess with your template’s publishable status, and you use 6.5.2, this SQL statement might help.

OK, just to follow up. I have changed the ‘second’ default template that I had setup for this content type to ‘publish always’ and now everything appears to be happy. Both of my files are being produced and the links for $rx.location.generate are going to the true ‘default’ template location without specifying the template as the second parameter.

Thanks for all of your help!