Canonical URL
Post here questions and problems related to editing and publishing DITA content.
-
- Posts: 18
- Joined: Thu Aug 27, 2009 5:09 pm
Canonical URL
Post 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
Thanks,
-Scot
-
- Posts: 4141
- Joined: Fri Mar 28, 2003 2:12 pm
Re: Canonical URL
Post 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:
There is already a <meta> element that is added there by default so you can just add your <meta> element after that:
Regards,
Sorin
You can add XHTML metadata tags in the Webhelp output by adding an XHTML <meta> element in the template:
Code: Select all
<xsl:template name="jsAndCSS">
Code: Select all
[Oxygen-install-dir]\frameworks\dita\DITA-OT\plugins\com.oxygenxml.webhelp\xsl\dita\desktop\common.xsl
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
-
- Posts: 18
- Joined: Thu Aug 27, 2009 5:09 pm
Re: Canonical URL
Post 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.
Any ideas? My XSL skills have atrophied apparently.
-
- Posts: 4141
- Joined: Fri Mar 28, 2003 2:12 pm
Re: Canonical URL
Post 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:
Regards,
Sorin
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:
Code: Select all
<xsl:param name="XML-file-path"/>
Code: Select all
<xsl:value-of select="concat($XML-file-path, '.html')"/>
Regards,
Sorin
-
- Posts: 18
- Joined: Thu Aug 27, 2009 5:09 pm
Re: Canonical URL
Post 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.
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.
-
- Posts: 4141
- Joined: Fri Mar 28, 2003 2:12 pm
Re: Canonical URL
Post 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
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
-
- Posts: 18
- Joined: Thu Aug 27, 2009 5:09 pm
Re: Canonical URL
Post 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:
2. In the jsAndCSS template, add the following:
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')"/>
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>
-
- Posts: 4141
- Joined: Fri Mar 28, 2003 2:12 pm
Re: Canonical URL
Post 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
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
-
- Posts: 1
- Joined: Tue Jan 08, 2019 1:35 am
Re: Canonical URL
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
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
-
- Posts: 846
- Joined: Mon Dec 05, 2011 6:04 pm
Re: Canonical URL
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
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
Costin Sandoi
oXygen XML Editor and Author Support
oXygen XML Editor and Author Support
-
- Posts: 77
- Joined: Tue Nov 14, 2017 8:34 pm
Re: Canonical URL
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
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
-
- Posts: 38
- Joined: Fri Jan 22, 2021 11:05 am
Re: Canonical URL
Post 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
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
Return to “DITA (Editing and Publishing DITA Content)”
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service