How Do I add last updated page information

usmanehsan0613's Avatar

usmanehsan0613

06 Sep, 2015 04:41 AM

Hi,

 I need to get last page update information (date and time) to append at the end of the page (i.e footer). Can you please help me in this.

 Thanks & Best Regards,
 Uthman

  1. 1 Posted by Wing Ming Chan on 07 Sep, 2015 12:43 PM

    Wing Ming Chan's Avatar

    Hi Uthman,

    Which type of formats are you working with: Velocity or XSLT?

    The reason why I asked is that you can pull page information from the index block calling-page, but depending on what type of format you have, the information you want is processed differently.

    Additional question: can you handle Java objects (like Date), or can you handle Xalan extension?

    Wing

  2. 2 Posted by usmanehsan0613 on 08 Sep, 2015 05:07 AM

    usmanehsan0613's Avatar

    Hi Wing

    I am working with XSLT format.

    From index block what argument name should i use to fetch last updated date information. e.g current-page/start-date , current-page/end-date under meta data tab of page.

    I can handle C# Date objects as my site is running on IIS.I guess installing JVM would require several other configurations.

    Please advise

    Thankyou

  3. 3 Posted by Ryan Griffith on 08 Sep, 2015 12:30 PM

    Ryan Griffith's Avatar

    Hi Uthman,

    Using a Calling Page Index Block, you can use this example XSLT format as a starting point; just remove the link and leave the date bits and you should be good to go. Here is a Velocity version of this Format that uses a Calling Page Index Block.

    Alternatively, if you wanted to use Velocity, you could use $currentPage.lastModified and the Date Tool to format the date:

    $_DateTool.format("MM/dd/YYYY", $currentPage.lastModified)
    

    Please let me know if you have any questions.

    Thanks!

  4. 4 Posted by Wing Ming Chan on 08 Sep, 2015 12:33 PM

    Wing Ming Chan's Avatar

    You can use system-page/last-modified (a timestamp). In _common:formats/include, there is a format named format-date that you can use to format the timestamp, or you can use my java-time-methods library to do the same thing.

    Wing

  5. 5 Posted by Ryan Griffith on 08 Sep, 2015 01:27 PM

    Ryan Griffith's Avatar

    Hi,

    For reference, here is the format-date XSLT Format include Wing mentioned in-case you don't have it.

  6. 6 Posted by usmanehsan0613 on 09 Sep, 2015 05:43 AM

    usmanehsan0613's Avatar

    Thanks Wing and Ryan for your support.

    First i am not able to fetch last-modified value ... here is the format i am using ..

    <!---->

    <xsl:variable name="front"/>
    <xsl:variable name="back">#highlight</xsl:variable>
    
    <xsl:template match="/system-index-block/calling-page/system-page">
        <xsl:value-of select="display-name"/>
        <xsl:text> Last updated: </xsl:text>
        <xsl:value-of select="last-modified"/>
    
    </xsl:template>
    

    /xsl:stylesheet

    as suggested by Ryan ( this example XSLT format).... Display name is coming fine but last-modified date is blank.

    Can you please suggest, whats wrong in the format.

    Many Thanks
    Uthman

  7. 7 Posted by usmanehsan0613 on 09 Sep, 2015 06:05 AM

    usmanehsan0613's Avatar

    I selected system metadata and now getting the last-modified value.

    But everytime i do publish the page it picks up publish date not when the content was edited.

    Is it possible to get the last-modified date of content not the publish date. ?

    Looking forward

    Many Thanks,
    Uthman

  8. 8 Posted by Ryan Griffith on 09 Sep, 2015 03:47 PM

    Ryan Griffith's Avatar

    Thank you for the follow up, Uthman, glad to hear you were able to access the date by including the system metadata in your Index Block.

    Is it possible to get the last-modified date of content not the publish date. ?

    Strange, using last-modified should definitely give you the last modified date and not the last published date, which would be last-published-on. Can you confirm you are not using last-published-on?

    Thanks

  9. 9 Posted by usmanehsan0613 on 10 Sep, 2015 04:06 AM

    usmanehsan0613's Avatar

    Hi Ryan,

    I tried again with content edited , Its giving me last modified date for content.

    Thanks for your support

    Regards,
    Uthman

  10. usmanehsan0613 closed this discussion on 10 Sep, 2015 04:06 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac