Skip to content

Commit

Permalink
Make npm run watch in website faster - skip generating social images
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Jun 5, 2024
1 parent bab2368 commit a04ed7e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions website/.eleventy.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,11 @@ module.exports = function (eleventyConfig) {
});

eleventyConfig.addAsyncShortcode('socialImages', async function (title) {
if (process.env.ELEVENTY_RUN_MODE === 'watch') {
return '<meta name="twitter:image" content="/tmp/images/logo-big.png" />'
+ "\n"
+ '<meta property="og:image" content="/tmp/images/logo-big.png" />';
}
const content = await eleventyConfig.nunjucksAsyncShortcodes.renderFile('./src/_includes/social/socialImage.njk', {
title: title,
date: DateTime.fromJSDate(this.page.date, {zone: 'utc'}).toFormat('DDD'),
Expand Down

0 comments on commit a04ed7e

Please sign in to comment.