Skip to content

contensio/plugin-last-updated

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Last Updated Badge

Displays an "Updated X days ago" badge in the post meta row whenever a post has been edited after its original publication date. Helps readers know whether content is fresh without needing to track individual edit timestamps themselves.

Features:

  • Badge only appears when the post was updated at least 1 day after publication - prevents false positives on the initial publish
  • Relative time label using Laravel Carbon's diffForHumans() (e.g. "Updated 3 days ago", "Updated 2 months ago")
  • Amber colour to visually distinguish it from the standard meta items
  • No admin configuration, no database queries at render time
  • Injects into the contensio/frontend/post-meta hook - renders inline with date and reading time

Requirements

  • Contensio 2.0 or later

Installation

Composer

composer require contensio/plugin-last-updated

Manual

Copy the plugin directory and register the service provider via the admin plugin manager.

No migrations or configuration required.


How it works

The plugin hooks into contensio/frontend/post-meta, which receives the Content model and the active ContentTranslation as arguments. It compares published_at and updated_at using Carbon's diffInDays(). If the difference is less than 1 day, no badge is rendered.

When the badge is shown, it outputs an inline <span> with a circular arrow icon and the relative time string:

· ↻ Updated 3 days ago

Hook reference

Hook Description
contensio/frontend/post-meta Injects the updated badge into the post meta row

About

Shows an 'Updated X days ago' badge on recently-edited posts in Contensio

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages