Custom topic IDs based on topic titles

Post here questions and problems related to editing and publishing DITA content.
Kevin
Posts: 1
Joined: Mon Apr 29, 2013 11:03 am

Custom topic IDs based on topic titles

Post by Kevin »

Is there any simple way of auto-generating topic ids based on topic titles? I see that oxygen provides some control over how IDs are generated, but it seems very limited. The reason for my request:

- I want to be able to generate one HTML output file per topic (not one output file per input file).
- Therefore I want to use the topic ID as the base for the file name.
- I want the file names to be reasonably descriptive of the contents (so the existing auto-generated IDs are no good).

Directly generating output file names based on topic titles is not acceptable, because then file names (and hence URLs) would be too volatile. Having file names that do not exactly match topic titles is, however, acceptable.
Radu
Posts: 9477
Joined: Fri Jul 09, 2004 5:18 pm

Re: Custom topic IDs based on topic titles

Post by Radu »

Hi Kevin,

If I understand correctly, inside a single file you have several DITA <topic> elements. Indeed an single HTML is generated from that topic file by default. But you are probably setting some chunking on the DITA Map to change this.
Why are you using this approach? You could define each topic in its own file and then aggregate them in the DITA Map. In this way, the DITA Map would reference directly the topic file name without any specified ID.

I understand your use case but we do not have such a feature (when the title is changed to update the ID based on that value). I do not think this could be implemented in a generic way because you would probably like to take control over the way in which the ID is computed based on the title (title which could have also inline elements in it). One problem could be if an element from another topic has a link to an element in this topic. Because if the ID changes when you edit the title, existing links to the previous ID could be broken.

We have enough Java API which would allow you to add a before-save listener and to change the ID of a topic based on its title, so if you want the approach of implementing an Oxygen plugin using our Plugins SDK I could give you more details about this.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply