9 Replies Latest reply on Jan 31, 2007 3:06 AM by KEBarlow

    Problem in templates with hyperlinks to bookmarks

    KEBarlow
      Hi. I'm using Robohelp X5. I have a template with a hyperlink in the footer, to link to the top of the page. The link works fine in topics that are in the root HTML Files folder (in the Project Manager tab) but it doesn't work in topics that are in sub-folders. The hyperlink target is being prefixed with "../" to account for the extra level. I have been asked not to use Javascript in the help, so need to use html. Does anyone know of a way to prevent the link being altered in the sub-level topics, or some other solution to the problem?
      I can't ask all the authors not to use folders to organise their topics, as some of the projects are large and they also use the folder structure when generating the TOC. I'd also rather not have to advise them to create a different version of the template for each folder in the topic structure, which is the only other way round it I can think of. Any advice would be greatly appreciated.
        • 1. Re: Problem in templates with hyperlinks to bookmarks
          RoboWizard Level 4
          Hi KEBarlow and welcome to our community

          Lemme guess. You have a bookmark on each page that is labeled "Top" or something similar and you are attempting to link to that?

          Here's a trick I always share with students in my RoboHelp HTML classes. There is absolutely no need to link this way. Linking to the top of the page couldn't be simpler. Just insert a pound symbol ( # ) where you would normally specify something like #Top.

          Cheers... Rick
          • 2. Re: Problem in templates with hyperlinks to bookmarks
            RoboWizard Level 4
            Forot to mention that doing it this way, you also have no need for inserting the "Top" Bookmark. Since # means the page you are on, you omit the superflous step of creating the bookmark and when linking, point only to #. The end result is that the page simply reloads and redisplays from the beginning. Actually, this is a better result than you would have otherwise achieved. This is because if you linked to a bookmark, going back to the top is inconsistent. It displays the page scrolled just a fuzz to position the bookmark.
            • 3. Re: Problem in templates with hyperlinks to bookmarks
              KEBarlow Level 1
              Hi RoboWizard,

              thanks for your quick reply. Unfortunately I have tried doing it both that way and with an explicit bookmark. I get the same result with both. With no bookmark and just # as the target, it still amends it to ../# in the topics in sub-folders. If I manually change this back to just # in those topics, I then get the standard message asking me if I want to detach teh topic from t eh template or make this change to the template as well. If I select to make it to the template too, it changes the link in the template to [sub-folder]/#, which is then incorrect for any topics not in the same sub-folder.
              • 4. Re: Problem in templates with hyperlinks to bookmarks
                RoboWizard Level 4
                Hi again KEBarlow

                Hmmm, one other possibility that comes to mind is to use a smidgeon of JavaScript. Try this:

                While editing the template, remove the footer text. Click Insert > Advanced > Script...
                Type document.write('<a href="#">Back to top<\/a>') into the Source field and click OK
                Apply the template to all topics.

                Since this will use JavaScript to perform a "write in" of the code, it shouldn't mess with your pathing.

                Hopefully this helps... Rick
                • 5. Re: Problem in templates with hyperlinks to bookmarks
                  KEBarlow Level 1
                  Hi again Rick,

                  I'm sorry to be such an awkward customer but I have already used Javascript to fix it temporarily, but the powers that be don't want any Javscript in the help, so want me to find a way to do it with HTML.
                  • 6. Re: Problem in templates with hyperlinks to bookmarks
                    MergeThis Level 4
                    Seems like the solution you discounted in your original post, "create a different version of the template for each folder in the topic structure," is the simplest one. I'm not sure why you'd "rather not have to advise them" to do this, unless your organization has some serious political or cultural issues.

                    Two other things:
                    1) How is the href="#" link affected by its folder placement? I just looked at a topic that sits inside a "mergedProjects - Installation" folder in merged WebHelp, and it remains the same as when I inserted it.

                    2) if you're generating WebHelp, take a look at how many .js files RH places in the output folder(s).


                    Good luck,
                    Leon
                    • 7. Re: Problem in templates with hyperlinks to bookmarks
                      KEBarlow Level 1
                      Thanks Leon,

                      some of the authors are new to online help and don't have much HTML or Robohelp experience. I'm worried that asking them to create new templates and link some topics to one template and some to another would lead to problems. For example, if they create a topic in one sub-folder and then later decide to move it to another folder, etc etc. I foresee trouble basically lol.

                      ../ is added in front of the link for every topic that is in a sub-folder in the Project Manager rather than the root folder. It's not the folder level of the published files that causes it.

                      Thanks for the reply and the luck ... Kat
                      • 8. Re: Problem in templates with hyperlinks to bookmarks
                        RoboWizard Level 4
                        Hi again Kat

                        Hmmm, quite a conundrum you have there, eh?

                        Well, there is one other possibility. Similar to the number 42, you probably won't like it much. But here goes anyway.

                        Assuming you are the person who has final say over the project, meaning that you are the only one that generates and distributes and the others are simply contributors, you could use something like ReplacEm or FAR to perform a small post generation process of performing a search and replace. You would search only the folders for the desired string looking for ../# and eliminate the ../ or possibly even ../../ or ../../../ depending on how many folder levels you have.

                        Besides that, I'm about out of ideas.

                        Sincerely... Rick
                        • 9. Re: Problem in templates with hyperlinks to bookmarks
                          KEBarlow Level 1
                          Hi again Rick,

                          thanks for all your advice on this. I've decided that the simplest thing to do might be just to argue the case for using Javascript with the development team. This is surely a prime example of how much more work would be created just by having to do everything in pure html?!

                          Now I really do need luck!

                          Thanks again... Kat