Copy link to clipboard
Copied
I'm using RoboHelp HTML 8. I've added a date last updated footer to my pages (borrowing the JavaScript for the date last updated from Peter Grainge's excellent site). What I'd like it to do is to display the date I actually made a change to each page and saved it. Unfortunately, it appears that each time I generate/publish my project, all of the pages have their last modified date updated to the date of publication. That means that all the pages show the date of publication as the the date last updated, even if they weren't changed. Is there any way to avoid that?
In the Generate dialog box, I don't have Republish All checked. I'm sure there must be some other setting that I'm overlooking.
Copy link to clipboard
Copied
Where is that script on my site?
See www.grainge.org for RoboHelp and Authoring tips
Copy link to clipboard
Copied
Sorry, Peter, I confused the date last modified script with another one that I got from your site. Anyway, the script that I'm using does indeed return the date last modified as reported in Windows Explorer. The problem is not the script; it's that the file's last modified date is changed to the current date in the publication process, which is what shouldn't happen.
For what it's worth. I'm reproducing the script below. It's one everyone should have.
<script
type="text/JavaScript"
language="JavaScript">
<!--
//
// format date as dd-mmm-yy
// example: 12-Jan-99
//
function date_ddmmmyy(date)
{
var d = date.getDate();
var m = date.getMonth() + 1;
var y = date.getYear();
// handle different year values
// returned by IE and NS in
// the year 2000.
if(y >= 2000)
{
y -= 2000;
}
if(y >= 100)
{
y -= 100;
}
// could use splitString() here
// but the following method is
// more compatible
var mmm =
( 1==m)?'Jan':( 2==m)?'Feb':(3==m)?'Mar':
( 4==m)?'Apr':( 5==m)?'May':(6==m)?'Jun':
( 7==m)?'Jul':( 8==m)?'Aug':(9==m)?'Sep':
(10==m)?'Oct':(11==m)?'Nov':'Dec';
return "" +
(d<10?"0"+d:d) + "-" +
mmm + "-" +
(y<10?"0"+y:y);
}
//
// get last modified date of the
// current document.
//
function date_lastmodified()
{
var lmd = document.lastModified;
var s = "Unknown";
var d1;
// check if we have a valid date
// before proceeding
if(0 != (d1=Date.parse(lmd)))
{
s = "" + date_ddmmmyy(new Date(d1));
}
return s;
}
//
// finally display the last modified date
// as DD-MMM-YY
//
document.write(
"This page was updated on " +
date_lastmodified() );
// -->
</script>
Copy link to clipboard
Copied
My lawyers will be in touch about the false accusation.
When the script is run it will look at the file it is in.
In the generated files, they are always new so you will get one date if you examine those. However, if you look at the published files as you don't have Republish All, their modified date will be the last time that file was generated with new content, which is what you want.
Have you looked at the server file attributes to ensure the modified date is correct?
Not sure why everyone should have this script if it doesn't work.
See www.grainge.org for RoboHelp and Authoring tips
Copy link to clipboard
Copied
Actually, the script does exactly what it's supposed to do -- report the file's Last Modified date. The problem may be in my understanding of generate vs. publish. Here's the way I understand it:
Help me understand if I portrayed the scenario incorrectly. I really would like to avoid the last bulleted item. My Date Last Updated should accurately reflect the date that an actual change in content was made to the content of a topic. My readers have no need or desire to know when I last generated the entire project. They want to know, "How current is the information in this topic?" There should be a way to have this automatically done. To have to do it manually on every single edited topic is not only onerous; it is also error-prone. I'm really hoping that there's a way around this publish/generate conundrum.
Copy link to clipboard
Copied
Publish essentially just copies files from one place to another. Granted, if you need additional services such as an FTP login, it provides addition support, but it is, at its core, a copy mechanism.
Absolutely not. You have not followed what is in my last post.
When you generate, that folder is cleared and the content is completely replaced so if you open the generated output, you will get one modified date.
When you publish however it does not just copy all those files unless you select Republish All. If you do not select that, then whilst the generated folder is all new content, RH knows to only copy the changed files to the server.
It follows the rest of your argument is wrong. It also follows the script does not work in RH unless you are getting something else wrong.
You might find it worth setting up a small project with half a dozen topics and generating and publishing that all locally. Publish into a folder created for that. Then make some changes to some topics. The files in the generate folder will change every time but the topic files in the publish folder should only change if the content changed, provided you do not select Republish all.
It is essential that you are using RoboHelp's publish page in the wizard for this to happen. If you are using some other FTP tool, then you will not get the same result.
See www.grainge.org for RoboHelp and Authoring tips