aboutsummaryrefslogtreecommitdiff
path: root/webmentions_ssg/templates
diff options
context:
space:
mode:
authorDennis Fink2026-11-18 19:18:18 +0100
committerDennis Fink2026-11-18 19:18:18 +0100
commitbeb0131b089293512c2dab2243b9b2ff314e2387 (patch)
tree2690eaa17c689a77bccdc1268e971a96ec0e368f /webmentions_ssg/templates
parente3e195ea07fd57288d32c842689ebed7fba636f0 (diff)
downloadwebmentions-ssg-beb0131b089293512c2dab2243b9b2ff314e2387.tar.gz
webmentions-ssg-beb0131b089293512c2dab2243b9b2ff314e2387.zip
feat(core): show relative timestamps
Add reusable UTC template filters backed by `humanize` so timestamps render as relative ages while preserving machine-readable `<time datetime>` values. Keep exact UTC timestamps available in tooltips across dashboard, received, sent, detail, and public status views.
Diffstat (limited to '')
-rw-r--r--webmentions_ssg/templates/dashboard.html6
-rw-r--r--webmentions_ssg/templates/received.html17
-rw-r--r--webmentions_ssg/templates/received_detail.html15
-rw-r--r--webmentions_ssg/templates/sent.html10
-rw-r--r--webmentions_ssg/templates/sent_source.html30
-rw-r--r--webmentions_ssg/templates/status.html10
6 files changed, 54 insertions, 34 deletions
diff --git a/webmentions_ssg/templates/dashboard.html b/webmentions_ssg/templates/dashboard.html
index 70e2bf0..b020d46 100644
--- a/webmentions_ssg/templates/dashboard.html
+++ b/webmentions_ssg/templates/dashboard.html
@@ -118,8 +118,10 @@ SPDX-License-Identifier: BSD-3-Clause
<div class="card-body">
<h3 class="h6 text-body-secondary">Last completed source scan</h3>
{% if last_scan %}
- <time datetime="{{ last_scan.isoformat() }}" class="fs-5">
- {{ last_scan.strftime("%Y-%m-%d %H:%M:%S") }} UTC
+ <time datetime="{{ last_scan | utc_isoformat }}"
+ class="fs-5"
+ title="{{ last_scan | utc_timestamp }}">
+ {{ last_scan | relative_time }}
</time>
{% else %}
<p class="text-body-secondary mb-0">No completed scan yet</p>
diff --git a/webmentions_ssg/templates/received.html b/webmentions_ssg/templates/received.html
index 2edf881..8931601 100644
--- a/webmentions_ssg/templates/received.html
+++ b/webmentions_ssg/templates/received.html
@@ -194,8 +194,9 @@ SPDX-License-Identifier: BSD-3-Clause
<a href="{{ webmention.source }}">{{ webmention.source }}</a>
<div class="small mt-1 d-md-none">
Received
- <time datetime="{{ webmention.created_at.isoformat() }}">
- {{ webmention.created_at.strftime("%Y-%m-%d %H:%M:%S") }}
+ <time datetime="{{ webmention.created_at | utc_isoformat }}"
+ title="{{ webmention.created_at | utc_timestamp }}">
+ {{ webmention.created_at | relative_time }}
</time>
</div>
</td>
@@ -203,15 +204,15 @@ SPDX-License-Identifier: BSD-3-Clause
<a href="{{ webmention.target }}">{{ webmention.target }}</a>
</td>
<td class="text-nowrap d-none d-md-table-cell">
- <time datetime="{{ webmention.created_at.isoformat() }}"
- title="{{ webmention.created_at.strftime('%Y-%m-%d %H:%M:%S') }} UTC">
- {{ webmention.created_at.strftime("%Y-%m-%d %H:%M:%S") }}
+ <time datetime="{{ webmention.created_at | utc_isoformat }}"
+ title="{{ webmention.created_at | utc_timestamp }}">
+ {{ webmention.created_at | relative_time }}
</time>
</td>
<td class="text-nowrap d-none d-md-table-cell">
- <time datetime="{{ webmention.updated_at.isoformat() }}"
- title="{{ webmention.updated_at.strftime('%Y-%m-%d %H:%M:%S') }} UTC">
- {{ webmention.updated_at.strftime("%Y-%m-%d %H:%M:%S") }}
+ <time datetime="{{ webmention.updated_at | utc_isoformat }}"
+ title="{{ webmention.updated_at | utc_timestamp }}">
+ {{ webmention.updated_at | relative_time }}
</time>
</td>
<td>
diff --git a/webmentions_ssg/templates/received_detail.html b/webmentions_ssg/templates/received_detail.html
index 32d3e05..38830bf 100644
--- a/webmentions_ssg/templates/received_detail.html
+++ b/webmentions_ssg/templates/received_detail.html
@@ -58,11 +58,17 @@ SPDX-License-Identifier: BSD-3-Clause
</dd>
<dt class="col-md-3">Received</dt>
<dd class="col-md-9">
- <time datetime="{{ webmention.created_at.isoformat() }}">{{ webmention.created_at.strftime("%Y-%m-%d %H:%M:%S") }} UTC</time>
+ <time datetime="{{ webmention.created_at | utc_isoformat }}"
+ title="{{ webmention.created_at | utc_timestamp }}">
+ {{ webmention.created_at | relative_time }}
+ </time>
</dd>
<dt class="col-md-3">Last updated</dt>
<dd class="col-md-9">
- <time datetime="{{ webmention.updated_at.isoformat() }}">{{ webmention.updated_at.strftime("%Y-%m-%d %H:%M:%S") }} UTC</time>
+ <time datetime="{{ webmention.updated_at | utc_isoformat }}"
+ title="{{ webmention.updated_at | utc_timestamp }}">
+ {{ webmention.updated_at | relative_time }}
+ </time>
</dd>
<dt class="col-md-3">Recovery attempts</dt>
<dd class="col-md-9">
@@ -128,8 +134,9 @@ SPDX-License-Identifier: BSD-3-Clause
<span class="badge {{ event_style.badge }}">{{ event_style.label }}</span>
<strong>{{ event.action }}</strong>
<time class="ms-auto text-body-secondary small"
- datetime="{{ event.occurred_at.isoformat() }}">
- {{ event.occurred_at.strftime("%Y-%m-%d %H:%M:%S") }} UTC
+ datetime="{{ event.occurred_at | utc_isoformat }}"
+ title="{{ event.occurred_at | utc_timestamp }}">
+ {{ event.occurred_at | relative_time }}
</time>
</div>
<div class="small text-body-secondary">Recovery attempts: {{ event.recovery_attempts }}</div>
diff --git a/webmentions_ssg/templates/sent.html b/webmentions_ssg/templates/sent.html
index d949f01..d2a319d 100644
--- a/webmentions_ssg/templates/sent.html
+++ b/webmentions_ssg/templates/sent.html
@@ -58,13 +58,15 @@ SPDX-License-Identifier: BSD-3-Clause
<td>{{ source.sent_webmentions | length }}</td>
<td class="d-none d-md-table-cell">{{ source.revision }}</td>
<td class="text-nowrap d-none d-md-table-cell">
- <time datetime="{{ source.created_at.isoformat() }}">
- {{ source.created_at.strftime("%Y-%m-%d %H:%M:%S") }}
+ <time datetime="{{ source.created_at | utc_isoformat }}"
+ title="{{ source.created_at | utc_timestamp }}">
+ {{ source.created_at | relative_time }}
</time>
</td>
<td class="text-nowrap d-none d-md-table-cell">
- <time datetime="{{ source.last_seen_at.isoformat() }}">
- {{ source.last_seen_at.strftime("%Y-%m-%d %H:%M:%S") }}
+ <time datetime="{{ source.last_seen_at | utc_isoformat }}"
+ title="{{ source.last_seen_at | utc_timestamp }}">
+ {{ source.last_seen_at | relative_time }}
</time>
</td>
<td>
diff --git a/webmentions_ssg/templates/sent_source.html b/webmentions_ssg/templates/sent_source.html
index 6e34458..33e26a2 100644
--- a/webmentions_ssg/templates/sent_source.html
+++ b/webmentions_ssg/templates/sent_source.html
@@ -51,20 +51,23 @@ SPDX-License-Identifier: BSD-3-Clause
</dd>
<dt class="col-sm-2">Created at</dt>
<dd class="col-sm-4">
- <time datetime="{{ source.created_at.isoformat() }}">
- {{ source.created_at.strftime("%Y-%m-%d %H:%M:%S") }}
+ <time datetime="{{ source.created_at | utc_isoformat }}"
+ title="{{ source.created_at | utc_timestamp }}">
+ {{ source.created_at | relative_time }}
</time>
</dd>
<dt class="col-sm-2">Last seen at</dt>
<dd class="col-sm-4">
- <time datetime="{{ source.last_seen_at.isoformat() }}">
- {{ source.last_seen_at.strftime("%Y-%m-%d %H:%M:%S") }}
+ <time datetime="{{ source.last_seen_at | utc_isoformat }}"
+ title="{{ source.last_seen_at | utc_timestamp }}">
+ {{ source.last_seen_at | relative_time }}
</time>
</dd>
<dt class="col-sm-2">Revised at</dt>
<dd class="col-sm-4">
- <time datetime="{{ source.revised_at.isoformat() }}">
- {{ source.revised_at.strftime("%Y-%m-%d %H:%M:%S") }}
+ <time datetime="{{ source.revised_at | utc_isoformat }}"
+ title="{{ source.revised_at | utc_timestamp }}">
+ {{ source.revised_at | relative_time }}
</time>
</dd>
<dt class="col-sm-2">Deleted at</dt>
@@ -72,8 +75,9 @@ SPDX-License-Identifier: BSD-3-Clause
{% if source.deleted_at is none %}
N/A
{% else %}
- <time datetime="{{ source.deleted_at.isoformat() }}">
- {{ source.deleted_at.strftime("%Y-%m-%d %H:%M:%S") }}
+ <time datetime="{{ source.deleted_at | utc_isoformat }}"
+ title="{{ source.deleted_at | utc_timestamp }}">
+ {{ source.deleted_at | relative_time }}
</time>
{% endif %}
</dd>
@@ -169,8 +173,9 @@ SPDX-License-Identifier: BSD-3-Clause
<strong>Attempted:</strong>
<br>
{% if webmention.last_attempted_at is not none %}
- <time datetime="{{ webmention.last_attempted_at.isoformat() }}">
- {{ webmention.last_attempted_at.strftime("%Y-%m-%d %H:%M:%S") }}
+ <time datetime="{{ webmention.last_attempted_at | utc_isoformat }}"
+ title="{{ webmention.last_attempted_at | utc_timestamp }}">
+ {{ webmention.last_attempted_at | relative_time }}
</time>
{% else %}
—
@@ -180,8 +185,9 @@ SPDX-License-Identifier: BSD-3-Clause
<strong>Sent:</strong>
<br>
{% if webmention.last_sent_at is not none %}
- <time datetime="{{ webmention.last_sent_at.isoformat() }}">
- {{ webmention.last_sent_at.strftime("%Y-%m-%d %H:%M:%S") }}
+ <time datetime="{{ webmention.last_sent_at | utc_isoformat }}"
+ title="{{ webmention.last_sent_at | utc_timestamp }}">
+ {{ webmention.last_sent_at | relative_time }}
</time>
{% else %}
—
diff --git a/webmentions_ssg/templates/status.html b/webmentions_ssg/templates/status.html
index a9a39b4..27821ff 100644
--- a/webmentions_ssg/templates/status.html
+++ b/webmentions_ssg/templates/status.html
@@ -44,14 +44,16 @@ SPDX-License-Identifier: BSD-3-Clause
</dd>
<dt class="col-sm-3">Received</dt>
<dd class="col-sm-9">
- <time datetime="{{ webmention.created_at.isoformat() }}">
- {{ webmention.created_at.strftime("%Y-%m-%d %H:%M:%S %Z") }}
+ <time datetime="{{ webmention.created_at | utc_isoformat }}"
+ title="{{ webmention.created_at | utc_timestamp }}">
+ {{ webmention.created_at | relative_time }}
</time>
</dd>
<dt class="col-sm-3">Last updated</dt>
<dd class="col-sm-9">
- <time datetime="{{ webmention.updated_at.isoformat() }}">
- {{ webmention.updated_at.strftime("%Y-%m-%d %H:%M:%S %Z") }}
+ <time datetime="{{ webmention.updated_at | utc_isoformat }}"
+ title="{{ webmention.updated_at | utc_timestamp }}">
+ {{ webmention.updated_at | relative_time }}
</time>
</dd>
<dt class="col-sm-3">ID</dt>