Skip to content

Commit 7b02301

Browse files
change year on footer to be dynamic
1 parent b380f08 commit 7b02301

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

client/src/views/footer.js

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,22 @@ export default ({ t, page }) =>
4646
{ process.env.TERMS && <span><a href={ process.env.TERMS } target="_blank">Terms &amp; </a></span> }
4747
{ process.env.PRIVACY && <span><a href={ process.env.PRIVACY } target="_blank">Privacy</a></span> }
4848
</div>
49-
<div>{ process.env.SITE_FOOTER || t`Powered by esplora` }</div>
49+
{
50+
(() => {
51+
let raw = process.env.SITE_FOOTER || t`Powered by esplora`
52+
const year = String(new Date().getFullYear())
53+
// if a year already exists in the footer text, replace it with the current year
54+
if (/\b\d{4}\b/.test(raw)) {
55+
return raw.replace(/\b\d{4}\b/, year)
56+
}
57+
// if the footer text starts with ©, insert the current year right after it
58+
if (raw.match(/^©/i)) {
59+
return raw.replace(/^©\s*/i, ${year} `)
60+
}
61+
// otherwise, just stick the current year at the front
62+
return `${year} ${raw}`
63+
})()
64+
}</div>
5065
</div>
5166
</div>
52-
</div>
5367
</footer>

flavors/blockstream/config.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export SITE_DESC='Blockstream Explorer is an open source block explorer providing detailed blockchain data across Bitcoin, Testnet, and Liquid. Supports Tor and tracking-free.'
2-
export SITE_FOOTER='© 2025 Blockstream Corporation Inc. All rights reserved.'
2+
export SITE_FOOTER='© Blockstream Corporation Inc. All rights reserved.'
33
export HEAD_HTML=\
44
'<meta property="og:image" content="https://blockstream.info/img/social-sharing.png">'\
55
'<meta name="twitter:image" content="https://blockstream.info/img/social-sharing.png">'\

0 commit comments

Comments
 (0)