Is it possible to create redirects in WebHelp Responsive?
Post here questions and problems related to editing and publishing DITA content.
-
- Posts: 23
- Joined: Sat Jun 24, 2023 7:35 pm
Is it possible to create redirects in WebHelp Responsive?
My team decided to change the name of one of our products and the URLs in our documentation (i.e. the topic names) reflected the old name of the product. I will have to change the topic filenames and, hence, the resulting URLs in WebHelp Responsive, but I don't want to leave the search engines and the users hanging in case they bookmarked an old name.
Is there any way to create new topics with old names that would be converted during publishing to WebHelp Responsive into HTML redirects? Such as <meta http-equiv="refresh" content="0; url=http://example.com/" />? And then, how to add these topics to the map so that they're not actually displayed anywhere, but still converted into HTML when the map is processed?
To make sure it's understood correctly, if I have a topic called old_product_name.dita, I will rename that file into new_product_name.dita, and I would like to create an old_product_name.dita file that will not have any content (or just information about redirecting) but would be converted into HTML with a redirect to new_product_name.html.
Is there any way to create new topics with old names that would be converted during publishing to WebHelp Responsive into HTML redirects? Such as <meta http-equiv="refresh" content="0; url=http://example.com/" />? And then, how to add these topics to the map so that they're not actually displayed anywhere, but still converted into HTML when the map is processed?
To make sure it's understood correctly, if I have a topic called old_product_name.dita, I will rename that file into new_product_name.dita, and I would like to create an old_product_name.dita file that will not have any content (or just information about redirecting) but would be converted into HTML with a redirect to new_product_name.html.
-
- Posts: 23
- Joined: Sat Jun 24, 2023 7:35 pm
Re: Is it possible to create redirects in WebHelp Responsive?
I found a method that is not very elegant at all and I hope there is a better way of doing that:
1. Create a redirects.xml file with a JavaScript script in the publishing template, like this:
2. Create topic files: new_url_1.dita, new_url_2.dita etc.
3. Put the topic files in the map with toc="no"
4. Modify the template, adding:
The ugliness of this solution is that the script is in every single topic HTML output file, and it just causes a redirect if the URL matches one of the redirect URLs.
Anyone has any idea of any other solution for this?
1. Create a redirects.xml file with a JavaScript script in the publishing template, like this:
Code: Select all
<script type="text/javascript"><!--
switch (window.location.pathname)
{
case "/topics/old_url_1.html":
window.location.href = "new_url_1.html";
break;
case "/topics/old_url_2.html":
window.location.href = "new_url_2.html";
break;
default:
break;
}
-->
</script>
3. Put the topic files in the map with toc="no"
4. Modify the template, adding:
Code: Select all
<fragment placeholder="webhelp.fragment.head" file="html-fragments/redirects.xml"/>
Anyone has any idea of any other solution for this?
-
- Posts: 161
- Joined: Mon Nov 24, 2014 1:49 pm
- Location: Greven/Germany
Re: Is it possible to create redirects in WebHelp Responsive?
Oxygen webhelp has a context sensitive system. I think this is what you need. https://www.oxygenxml.com/doc/versions/ ... itive.html
stefan-jung.org – Your DITA/DITA-OT XML consultant
-
- Posts: 847
- Joined: Mon Dec 05, 2011 6:04 pm
Re: Is it possible to create redirects in WebHelp Responsive?
Hi TumasN,
It seems that the solution you stumbled upon implies a client-side redirect action.
However, the recommended way to go would be to try implementing a redirect directly on the HTTP server that hosts the WebHelp resources instead of client-side redirecting.
Regards,
Costin
It seems that the solution you stumbled upon implies a client-side redirect action.
However, the recommended way to go would be to try implementing a redirect directly on the HTTP server that hosts the WebHelp resources instead of client-side redirecting.
Regards,
Costin
Costin Sandoi
oXygen XML Editor and Author Support
oXygen XML Editor and Author Support
-
- Posts: 23
- Joined: Sat Jun 24, 2023 7:35 pm
Re: Is it possible to create redirects in WebHelp Responsive?
@Xephon
I've accessed this documentation and I can't figure out how this would solve my problem... Would you be so kind as to explain more what you have on your mind?
@Costin
Thanks, Costin, but still that would not solve the problem of maintaining it in the source repository as part of the DITA build. Also, I don't have that option with the way our server is set up, so it has to be client-side. And I'm fine with client-side, whether it's using JavaScript or a meta tag. What I'm not fine is having to maintain it in the template separately, and having the extra JavaScript code on pages that don't have/need redirects.
Is there any way to avoid having to use webhelp.fragment.* to provide such client-side HTML in the WebHelp Responsive output or is this the only way?
I've accessed this documentation and I can't figure out how this would solve my problem... Would you be so kind as to explain more what you have on your mind?
@Costin
Thanks, Costin, but still that would not solve the problem of maintaining it in the source repository as part of the DITA build. Also, I don't have that option with the way our server is set up, so it has to be client-side. And I'm fine with client-side, whether it's using JavaScript or a meta tag. What I'm not fine is having to maintain it in the template separately, and having the extra JavaScript code on pages that don't have/need redirects.
Is there any way to avoid having to use webhelp.fragment.* to provide such client-side HTML in the WebHelp Responsive output or is this the only way?
-
- Site Admin
- Posts: 276
- Joined: Thu Dec 24, 2009 11:21 am
Re: Is it possible to create redirects in WebHelp Responsive?
Hello,
You can create dummy topic files corresponding to the old topics and add the following content into the prolog section:
where path/to/new/topic.html is the path of the new topic's HTML file relative to the old topic file.
Then use an XSLT extension to rename the othermeta's @name attribute to @http-equiv.
You can use the following sample publishing template as an example:
https://github.com/oxygenxml/oxygen-pub ... a-in-topic
This way the mappings between the old topics and new topics are stored inside the DITA topics.
Regards,
Alin
You can create dummy topic files corresponding to the old topics and add the following content into the prolog section:
Code: Select all
<metadata>
<othermeta name="refresh" content="0;url=path/to/new-topic.html"/>
</metadata>
Then use an XSLT extension to rename the othermeta's @name attribute to @http-equiv.
You can use the following sample publishing template as an example:
https://github.com/oxygenxml/oxygen-pub ... a-in-topic
This way the mappings between the old topics and new topics are stored inside the DITA topics.
Regards,
Alin
Alin Balasa
Software Developer
<oXygen/> XML Editor
http://www.oxygenxml.com
Software Developer
<oXygen/> XML Editor
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)
- ↳ Artificial Intelligence (AI Positron Assistant add-on)
- ↳ 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