pressbooks / ideas

Ideas for Pressbooks.
GNU General Public License v3.0
12 stars 4 forks source link

Show "Last revised" date on each page #414

Open alanngnet opened 2 years ago

alanngnet commented 2 years ago

Feature Description

Give authors the option of turning on a "This section/chapter last revised on [date] [?time]" text displayed at the bottom of every "chapter" in a Pressbook. For an implementation example on native WordPress, see the pages of this OER textbook: https://courses.dcs.wisc.edu/wp/readinggerman/introduction/

The above example was implemented quite easily, with a very small modification to the WordPress theme in use at the above site, in the "content-single.php" file, as follows:

$utility_text = __( 'Last revised on %7$s.', 'uwmadison' );
printf(
          $utility_text,
          $categories_list,
          $tag_list,
          esc_url( get_permalink() ),
          the_title_attribute( 'echo=0' ),
          get_the_author(),
          esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
          /* this 7th item added for Textbook theme: */
          get_the_modified_date()
);

The function get_the_modified_date() is of course part of core WordPress: https://developer.wordpress.org/reference/functions/get_the_modified_date/

Feature Use Case

Reference works and textbooks with any sort of shelf-life beyond "disposable" are continuously maintained and updated on a page-by-page basis, often by a team or community of contributors who each work on various specific pages/sections at any given time. A simple best practice of exposing each webpage's most recent revision date is helpful to both contributors and readers. A book-level "last modified" date for this type of work is at best misleading, especially in the most-established works, where some relatively stable sections of a book may not have been revised in many years, while other sections are much more dynamic.

Other Notes

This feature is related to - and would be a complementary solution alongside - the open issue https://github.com/pressbooks/ideas/issues/133

SteelWagstaff commented 2 years ago

Hi Alan -- this is a great idea. Appreciate the code example you provided as well. Will add this to our backlog for refinement shortly!

alanngnet commented 2 years ago

Hi Alan -- this is a great idea. Appreciate the code example you provided as well. Will add this to our backlog for refinement shortly!

Hi Steel! Nice surprise to see you're still a PressBooks champion all these years later. Thank you very much for the fast response!