chore: use app version to populate version query params

This commit is contained in:
Cory Dransfeldt 2024-01-12 12:37:43 -08:00
parent 631a50f7bd
commit b4a2655d0a
No known key found for this signature in database
3 changed files with 11 additions and 5 deletions

View file

@ -23,6 +23,12 @@ import { execSync } from 'child_process'
import dotenvFlow from 'dotenv-flow' import dotenvFlow from 'dotenv-flow'
dotenvFlow.config() dotenvFlow.config()
// get app version
import { createRequire } from 'module'
const require = createRequire(import.meta.url)
const appVersion = require('./package.json').version
/** /**
* @param {import("@11ty/eleventy/src/UserConfig")} eleventyConfig * @param {import("@11ty/eleventy/src/UserConfig")} eleventyConfig
*/ */
@ -104,7 +110,7 @@ export default async function (eleventyConfig) {
// shortcodes // shortcodes
eleventyConfig.addShortcode('image', img) eleventyConfig.addShortcode('image', img)
eleventyConfig.addShortcode('assetHash', () => Math.random()) eleventyConfig.addShortcode('appVersion', () => appVersion)
// transforms // transforms
eleventyConfig.addTransform('html-minify', (content, path) => { eleventyConfig.addTransform('html-minify', (content, path) => {

View file

@ -1,6 +1,6 @@
{ {
"name": "coryd.dev", "name": "coryd.dev",
"version": "4.7.1", "version": "4.8.0",
"description": "The source for my personal site, blog and portfolio. Built using 11ty and hosted on Netlify.", "description": "The source for my personal site, blog and portfolio. Built using 11ty and hosted on Netlify.",
"type": "module", "type": "module",
"scripts": { "scripts": {

View file

@ -22,14 +22,14 @@
<meta name="generator" content="{{ eleventy.generator }}"> <meta name="generator" content="{{ eleventy.generator }}">
<meta name="robots" content="noai, noimageai"> <meta name="robots" content="noai, noimageai">
<link <link
href="/assets/icons/favicon.ico?v={% assetHash %}" href="/assets/icons/favicon.ico?v={% appVersion %}"
rel="icon" rel="icon"
sizes="any"> sizes="any">
<link <link
href="/assets/icons/favicon.svg?v={% assetHash %}" href="/assets/icons/favicon.svg?v={% appVersion %}"
rel="icon" rel="icon"
type="image/svg+xml"> type="image/svg+xml">
<link href="/assets/icons/apple-touch-icon.png?v={% assetHash %}" rel="apple-touch-icon"> <link href="/assets/icons/apple-touch-icon.png?v={% appVersion %}" rel="apple-touch-icon">
{% capture css %} {% capture css %}
{% render "../assets/styles/fonts/silka.css" %} {% render "../assets/styles/fonts/silka.css" %}
{% render "../assets/styles/partials/vars.css" %} {% render "../assets/styles/partials/vars.css" %}