Copy link to clipboard
Copied
Apologies if this is a duplicate post. The submittal GUI choked when I clicked Post.
I have a particular use case for which I'd like the webhelp output to include the <meta name="rh-authors" content="writername"> that's in each of our topics. Not in a generally visible manner, just as part of the meta content in the topic HTML. I dug around in xmls, js, and DLLs but could not find an obvious file to try hacking. Has anyone ever found a way to accomplish this?
D
Copy link to clipboard
Copied
Hi there
Unfortunately there isn't any way I'm aware of that you can accomplish this via meta tags.
What you might consider is hiding this information inside a DHTML drop-down somewhere on the page. I used to include a table that listed modifications made to the page, who made them and the date they were made. None of this was visible unless the user clicked a specific image on the page.
Cheers... Rick
Copy link to clipboard
Copied
Thanks Rick.
I will take a look at whether there is an automated way to excerpt the meta tag and add it into a clickable box...we have more than 2400 topics so i do not want to do it manually
Thanks again!
D
Copy link to clipboard
Copied
You can do this with a little JavaScript. For an example, see http://stackoverflow.com/questions/7524585/how-do-i-get-the-information-from-a-meta-tag-with-javascr...
For example by adding the following to the footer of your page (Didn't test the script, just made it based on the script provided in the link above):
<p>
<script type="text/javascript">
writeAuthor();
function writeAuthor() {
var metas = document.getElementsByTagName('meta');
for (i=0; i<metas.length; i++) {
if (metas.getAttribute("property") == "rh-authors") {
document.write(metas.getAttribute("content"));
}
}
}
</script>
</p>
Copy link to clipboard
Copied
Hi William
Thanks so much for responding. I like the idea but doesn't the javascript only get instantiated after the help is generated? At that point, the meta tag item I want is actually removed from the HTML. It appears that only some of them are passed through -- which is the problem. If the meta tag for author was present in the output HTML that would suffice.
Forgive my ignorance, but I'm not seeing how adding the javascript to the topics in RH will trigger the extraction to occur in a way that is retained through to webhelp output?
Sorry -- I have been tinkering with your recommendation and scripting and just am not getting it.
Copy link to clipboard
Copied
If the tag is removed, you can't use the provided script to show it. Alternatively, you can use an ExtendScript to add the content to your output once you generate but this may be a hassle if you're not familiar with scripting. The easiest solution may just be to manually type in the author name in the topics.