Bulk assign text variables

Please post all questions on Help+Manual 8 here

Moderators: Alexander Halser, Tim Green

Post Reply
esjch2020
Posts: 7
Joined: Wed Nov 18, 2020 8:09 pm

Bulk assign text variables

Unread post by esjch2020 »

Is it possible to bulk assign text variables?

We're using the full version of Zoom Indexer and I'd like to add the text variable for ZoomCategory to all our articles, however we have a lot. Is there a way to do this in bulk in H&M?
esjch2020
Posts: 7
Joined: Wed Nov 18, 2020 8:09 pm

Re: Bulk assign text variables

Unread post by esjch2020 »

It may be worth adding, that I tried adding it to the HTML template, however we call several projects within a master project before publishing and therefor the master project and skin override the sub project's HTML templates so instead what I've found works is adding <meta name="ZOOMCATEGORY" content="<%ZoomCategory%>"> applies this to each page, and then if the topic has the ZoomCategory text variable, it will populate it correctly.
User avatar
Tim Green
Site Admin
Posts: 23178
Joined: Mon Jun 24, 2002 9:11 am
Location: Bruehl, Germany
Contact:

Re: Bulk assign text variables

Unread post by Tim Green »

Is it possible to bulk assign text variables?
That's a rather broad question. What exactly do you want to do here? Are you defining them for the entire project, or are you redefining variables for individual topics? For the entire project you can use an external variable file in INI format, publish with the command line interface and import the variables with the /V= switch referencing the variables file:

https://www.helpandmanual.com/help/hm_a ... yntax.html
what I've found works is adding <meta name="ZOOMCATEGORY" content="<%ZoomCategory%>"> applies this to each page, and then if the topic has the ZoomCategory text variable, it will populate it correctly.
Does this mean that this is a solution to what you're trying to do? It's still not entirely clear what you want to achieve here... :?
Regards,
Tim (EC Software Documentation & User Support)

Private support:
Please do not email or PM me with private support requests -- post to the forum directly.
esjch2020
Posts: 7
Joined: Wed Nov 18, 2020 8:09 pm

Re: Bulk assign text variables

Unread post by esjch2020 »

Hello Tim,

Thanks for the quick response and pardon the confusing post. Hopefully this will help clear it up a bit.

Here is a hierarchical simplified example of what our setup looks like:
AllProducts.hmxp
>> Product1.hmxp
>>>> Product1_Topics*.xml
>> Product2.hmxp
>>>> Product2_Topics*.xml
>> Product3.hmxp
>>>> Product3_Topics*.xml

We're trying to implement the feature from the Professional Zoom indexer functionality that allows end users to search specific categories, so we could allow them to search specific sections (Product1, Product2, Product3, etc). The snippet of their documentation I'm working with is:
Specifying category per file

For files which have no easy way to be categorized by a pattern in the filename or URL, you can specify a category for these files on a file-by-file basis. You do this by adding a ZOOMCATEGORY meta tag within your file, like so:

<meta name="ZOOMCATEGORY" content="Product1">

Specifying the name of the category in the content part of the meta tag. This above example will categorize the file in the "Product1" category (overriding the URL/filename matching method).
At publish time, we build the help via commandline for AllProduct.hmxp, which includes all the sub products and their articles (Product1, Product2, Product3, etc.) I've tried setting this line to the Configuration > HTML Page Templates for the Product* however this seems to be superseded by AllProducts.hmxp setup, and we will need each product will have their own ZOOMCATEGORY for each topic, but the topics don't have this meta name applied.

I've found a solution by applying <meta name="ZOOMCATEGORY" content="<%ZoomCategory%> to the Configuration > HTML Page Templates in our skin. This adds this meta name to every topic, and if the topic has a TEXT VARIABLE assigned, it will pick this up and add use it for the topic.

The question I'm asking is if there is a way to bulk assign this TEXT VARIABLE to all topics. We have about 500 topics under Product1, and hundreds for the other products as well and going through each topic to add this VARIABLE would be tedious.

Writing this out now, I'm also curious if there is a way to also add this Variable when a topic is created.

The INI option seems interesting but concerned it wouldn't work with how we build our documentation. Each sub-project would need it's own INI because it would have it's own set of variables.
User avatar
Tim Green
Site Admin
Posts: 23178
Joined: Mon Jun 24, 2002 9:11 am
Location: Bruehl, Germany
Contact:

Re: Bulk assign text variables

Unread post by Tim Green »

Ah, now I understand what you're doing.
The question I'm asking is if there is a way to bulk assign this TEXT VARIABLE to all topics. We have about 500 topics under Product1, and hundreds for the other products as well and going through each topic to add this VARIABLE would be tedious.
You can't do this from within Help+Manual itself, but it's easy to do externally on the topic XML files. You just need to use any editor that can perform search and replace on multiple files. Ideally the editor should support regular expressions, like the free Notepad++, or (even better) the fantastic PowerGREP tool.

Create a dummy topic with the variable as you want to have it and look in the XML tab before and after (on the left of the topic editor) to get the XML code you need to replace. Then you just need to run your editor's search and replace on the XML topic files in the /Topics folder of your project. Your project needs to be saved in the uncompressed HMXP format for you to be able to do this, but you should be using that for your ongoing work anyway.
Writing this out now, I'm also curious if there is a way to also add this Variable when a topic is created.
That is also possible. You just need to set up the dummy topic you want to have by default and save it as the default content template to be used for new topics. See here for instructions:

https://www.helpandmanual.com/help/hm_a ... ntent.html
The INI option seems interesting but concerned it wouldn't work with how we build our documentation. Each sub-project would need it's own INI because it would have it's own set of variables.
That wouldn't work if you need a different setting for each child project because that too would be applied to the entire output.
Regards,
Tim (EC Software Documentation & User Support)

Private support:
Please do not email or PM me with private support requests -- post to the forum directly.
Post Reply