Page 1 of 1
Canonical URL
Posted: Tue Nov 26, 2013 3:15 am
by scotmarvin
Hi, I'm trying to figure out how to generate a canonical URL in the webhelp metadata. Is there a way to have Oxygen's webhelp generate such additional metadata?
Thanks,
-Scot
Re: Canonical URL
Posted: Tue Nov 26, 2013 2:27 pm
by sorin_ristache
Hi,
You can add XHTML metadata tags in the Webhelp output by adding an XHTML
<meta> element in the template:
in the stylesheet:
Code: Select all
[Oxygen-install-dir]\frameworks\dita\DITA-OT\plugins\com.oxygenxml.webhelp\xsl\dita\desktop\common.xsl
There is already a
<meta> element that is added there by default so you can just add your
<meta> element after that:
Code: Select all
<meta xmlns="http://www.w3.org/1999/xhtml" http-equiv="Content-Type" content="text/html; charset=utf-8"><xsl:comment/></meta>
Regards,
Sorin
Re: Canonical URL
Posted: Wed Nov 27, 2013 4:02 am
by scotmarvin
Thanks, Sorin. I was able to generate the path, but then it hit: I'm not all that smart. How the heck do I get the filename of the XML file (or its ID--which is the same in our repository) and then append ".html"?
Any ideas? My XSL skills have atrophied apparently.
Re: Canonical URL
Posted: Wed Nov 27, 2013 11:33 am
by sorin_ristache
Do you have to read the filename of the XML file in the XSLT code? If yes how or where do you read it?
Or maybe you receive it from the process that calls the XSLT stylesheet? In this case you can pass it as a parameter that is received in XSLT with a line like:
You append the file extension with an element like:
Code: Select all
<xsl:value-of select="concat($XML-file-path, '.html')"/>
Regards,
Sorin
Re: Canonical URL
Posted: Wed Nov 27, 2013 11:41 pm
by scotmarvin
Actually, I'm not sure what we have to do. Currently, we're not passing it along. I've read that this is the only way to get the information I need. When I try a general XPATH-based solution, like base-uri, I only get the name of the XSL file which, in this case, is common.xsl.
Your solution about getting the param and appending the ".html" onto it seems like it should work (currently, it generates a "href='.html'". So how the heck do I pass along each XML filename parameter? I mean, the processor is working on each file in the ditamap. It seems like there's some way to address this. I just don't know how.
Re: Canonical URL
Posted: Thu Nov 28, 2013 11:56 am
by sorin_ristache
Hi Scott,
You should start from document-uri(/). If you need only the file name, just extract it from the URI of the XML document returned by this function call.
Regards,
Sorin
Re: Canonical URL
Posted: Mon Jan 06, 2014 8:29 pm
by scotmarvin
Just in case anyone else hasn't figured this out, here's what my lovely wife came up with and it works great (all edits in /frameworks/dita/DITA-OT/plugins/comoxygenxml.webhelp/xsl/dita/desktop/common.xsl):
1. At the top, with the other params, add the following params:
Code: Select all
<xsl:param name="pathuri" select="tokenize(document-uri(/), 'oxygen_dita_temp')[last()]"/>
<xsl:param name="filename" select="tokenize($pathuri, '\.')[1]"/>
<xsl:param name="fileuri" select="concat($filename, '.html')"/>
2. In the jsAndCSS template, add the following:
Code: Select all
<link rel="canonical">
<xsl:attribute name="href">http://www.eucalyptus.com/docs/eucalyptus/latest<xsl:value-of select="$fileuri"/></xsl:attribute>
</link>
Re: Canonical URL
Posted: Tue Jan 07, 2014 11:58 am
by sorin_ristache
Hi Scot,
Thank you for letting us know.
The variable fileuri will hold a file name, not a URI. Anyway it is good that you could create the URI that you need in the <link rel="canonical"> element.
Regards,
Sorin
Re: Canonical URL
Posted: Tue Jan 08, 2019 1:42 am
by jomjohn
I am attempting to add a <link rel="canonical"> element to the latest webhelp responsive (com.oxygenxml.webhelp.responsive) output.
The template <xsl:template name="jsAndCSS"> does not exist as it did with the classic webhelp.
Can you please give me direction on the appropriate template to override?
thanks,
-Josh
Re: Canonical URL
Posted: Tue Jan 08, 2019 3:51 pm
by Costin
Hello,
Please note that com.oxygenxml.webhelp.classic and com.oxygenxml.webhelp.responsive are two separate plugins with totally different templates, so you could not interchange templates from one plugin to the other.
If you need to customize the WebHelp Responsive output, by inserting custom content (like references to additional JavaScript, CSS, and other types of resources), you could use XML files that contain HTML fragments that contain the references to that content.
More details on using HTML fragments to customize the WebHelp Responsive output available in
the "How to Insert HTML Content in WebHelp Responsive Output" section from the User-Guide.
Regards,
Costin
Re: Canonical URL
Posted: Wed Nov 29, 2023 9:03 am
by syed
Hi,
Are there instructions to add the canonical link for the Webhelp Responsive output? I am using v25. In my case, the href value has to be supplied by the teams because each team will have a different URL. Maybe like the sitemap.base.url parameter, there can be a canonical.url parameter?
Syed
Re: Canonical URL
Posted: Tue Dec 05, 2023 3:49 pm
by beniamin_savu
Hi,
Unfortunately we do not have a way to add canonical link for the WebHelp Responsive output out of the box. We added an issue (WH-3257) in our internal issue tracker to be further analyzed by our development team. We will let you know when it will be implemented.
However, WebHelp can be customized using XSLT Extension Points. We think it may be possible to achieve this functionality by creating a custom XSLT that adds a link with the canonical URL.
Best regards,
Beniamin Savu
Oxygen WebHelp Team
http://www.oxygenxml.com