Skip to content

Add <time> metadata to publication dates. #5411

@edent

Description

@edent

Please can we add the <time> HTML element to things like publication dates and last updated dates?

Documentation: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/time

This will allow users and machines to semanticly understand when a document was published/updated.

At the moment, the HTML is rendered as:

<div class="app-c-published-dates " lang="en">
    Published 21 April 2016
    <br>Last updated 21 July 2016
      — <a href="#history" class="app-c-published-dates__history-link govuk-link">see all updates</a>
</div>

Under this proposal, it would be:

<div class="app-c-published-dates " lang="en">
    Published <time datetime="2016-04-21">21 April 2016</time>
    <br>Last updated <time datetime="2016-07-21">21 July 2016</time>
      — <a href="#history" class="app-c-published-dates__history-link govuk-link">see all updates</a>
</div>

I think the relevant change needs to be made at:
https://github.com/alphagov/government-frontend/blob/79e5c4d5862c321b404008ed734598ba70020d50/app/views/components/_published-dates.html.erb#L12

The metadata element just needs an ISO8601 timestamp passed to it - of any precision.

As per the comment at co-cddo/open-standards#75 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions