Skip to content

Commit e1c5203

Browse files
committed
Auto-append a cachebust URL to preview links
On the "preview" links we surface on the document summary screen, we want to append a `?cachebust={timestamp}` parameter, where `timestamp` is the current time in seconds (unix epoch time) I have auto-appended a cachebust URL query parameter to: - Normal document preview - Translation preview We get some confusing support tickets where multiple publishers coalescee around the same document. A lot of the time, the underlying reason for the support ticket is caching. For example, two publishers previewing a document and seeing different things, because one of them had an older version cached already. Adding a cachebust string will force a fresh preview everytime the publisher clicks on the preview link, which should minimise the number of support tickets coming our way.
1 parent 0f5896d commit e1c5203

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

app/components/admin/editions/show/preview_component.html.erb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@
99

1010
<% if versioning_completed %>
1111
<p class="govuk-body">
12-
<%= preview_link(primary_locale_link_text, local_edition.public_url(draft: true)) %>
12+
<%= preview_link(primary_locale_link_text, local_edition.public_url({ draft: true }.merge(cachebust_url_options))) %>
1313
</p>
1414

1515
<% if available_in_multiple_languages %>
1616
<% translation_preview_links = local_edition.non_primary_translation_locales.map do |locale|
1717
preview_link(
1818
"Preview on website - #{locale.native_and_english_language_name} (opens in new tab)",
19-
local_edition.public_url(locale: locale.code, draft: true),
19+
local_edition.public_url({ locale: locale.code, draft: true }.merge(cachebust_url_options)),
2020
)
2121
end %>
2222
<%= render "govuk_publishing_components/components/details", {

0 commit comments

Comments
 (0)