Page 1 of 1

Failed using webhelp macros

Posted: Thu Jul 07, 2022 3:18 pm
by Nadia
Hello
I use DITA-OT 2.54, webhelp 20.1 with the build 2018042310, and the oxygen.webhelp.responsive plugin.

I have to add the following meta tag to my wt_topic.html:

Code: Select all

<link rel="canonical" href="https://example.com/topic_id" />

It requres me to use a special variable for a topic id. I've read this article for webhelp 20.1, and found out that I can use the parameter topic-xpath that can be used to execute an XPath expression over the current topic.

I tried different parameters:

Code: Select all

<link rel="canonical" href="https://example.com/${topic-xpath(/topic/@id)}" /> //(my custom one)
<link rel="canonical" href="${topic-xpath(string-join(//shortdesc//text(), ' '))}" />  // (from the example)
<link rel="canonical" href="only this command works ${oxygen-webhelp-assets-dir}" /> // (from the example) 

But only the last one works. Can you recommend me, please, what I should fix to be able to insert a topic_id as a varible in the meta tag?

Regards,
Nadia
image.png

Re: Failed using webhelp macros

Posted: Fri Jul 08, 2022 3:51 pm
by alin
Hello,

I have tested your example with WebHelp 20.1 and the macros were expanded correctly for all three <link> elements.
Image

Regards,
Alin