Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions _data/site.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"keywords": "Dane Bertram, Software Developer, YNAB, Articulate, Fog Creek Software, FogBugz, WebPutty, Dabsoft Solutions, Dane the Canadian, do these actually do anything?",
"url": "https://danebertram.com/",
"image": "/assets/images/dane_bertram_avatar.jpg",
"og_image": "/dane_bertram_avatar.jpg",
"header": {
"nameplate_email": "mailto:dbertram+resume@gmail.com",
"tagline_html": "A proud builder of bits at <abbr title=\"You Need A Budget\">YNAB</abbr>",
Expand Down
4 changes: 2 additions & 2 deletions _includes/layouts/base.njk
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

<meta property="og:title" content="{{ site.name }} - {{ site.title }}">
<meta property="og:type" content="website">
<meta property="og:url" content="{{ site.url }}">
<meta property="og:image" content="{{ site.image }}">
<meta property="og:url" content="{{ page.url | absoluteUrl(deployOrigin) }}">
<meta property="og:image" content="{{ site.og_image | absoluteUrl(deployOrigin) }}">

<link rel="shortcut icon" href="/favicon.ico" />
<link rel="stylesheet" href="/assets/styles/main.scss" />
Expand Down
22 changes: 17 additions & 5 deletions eleventy.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,25 @@ import { formatMonthYear } from './src/shared/date.mjs'
const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)
const siteData = JSON.parse(fs.readFileSync(path.join(__dirname, '_data', 'site.json'), 'utf8'))
const isDevServer = process.env.ELEVENTY_ENV === 'development'
const deployOrigin =
process.env.DEPLOY_PRIME_URL ?? // Netlify branch deploys and deploy previews
process.env.URL ?? // Netlify production deploys
(process.env.ELEVENTY_ENV === 'development' ? 'http://localhost:8080/' : siteData.url)

function toAbsoluteUrl(pathname, origin = deployOrigin) {
if (!pathname) {
return origin
}

return new URL(pathname, origin).href
}

export default function (eleventyConfig) {
eleventyConfig.addPlugin(EleventyVitePlugin, {
viteOptions: {
base: isDevServer ? '/' : siteData.url, // ensures og:image meta tag uses an absolute URL instead of relative
},
eleventyConfig.addPlugin(EleventyVitePlugin)

eleventyConfig.addGlobalData('deployOrigin', deployOrigin)
eleventyConfig.addFilter('absoluteUrl', (pathname, origin = deployOrigin) => {
return toAbsoluteUrl(pathname, origin)
})

const iconsDirectory = path.join(__dirname, '_includes', 'icons')
Expand Down
Binary file added public/dane_bertram_avatar.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.