Create photo_exif liquid component + update photography blogs to use it
This commit is contained in:
@@ -4,6 +4,9 @@ import brokenLinksPlugin from 'eleventy-plugin-broken-links'
|
||||
import { eleventyImageTransformPlugin } from '@11ty/eleventy-img'
|
||||
import syntaxHighlight from '@11ty/eleventy-plugin-syntaxhighlight'
|
||||
import footnote from 'markdown-it-footnote'
|
||||
import fetch from 'node-fetch'
|
||||
import fs from 'node:fs'
|
||||
import exifParser from 'exif-parser'
|
||||
import { EleventyRenderPlugin, IdAttributePlugin } from '@11ty/eleventy'
|
||||
import { setupBlogCollections } from './scripts/eleventy/blog.js'
|
||||
import { setupFeedCollections } from './scripts/eleventy/feed.js'
|
||||
@@ -33,6 +36,16 @@ const setupPlugins = eleventyConfig => {
|
||||
eleventyConfig.addLiquidFilter('dateToRfc822', rssPlugin.dateToRfc822)
|
||||
eleventyConfig.addLiquidFilter('dateToRfc3339', rssPlugin.dateToRfc3339)
|
||||
eleventyConfig.addLiquidFilter('getNewestCollectionItemDate', rssPlugin.getNewestCollectionItemDate)
|
||||
|
||||
eleventyConfig.addLiquidFilter('parseExif', async (src) => {
|
||||
const content = src.startsWith('https://')
|
||||
? await fetch(src).then(r => r.arrayBuffer())
|
||||
: fs.readFileSync(src)
|
||||
|
||||
const result = exifParser.create(content).parse()
|
||||
console.log({ result })
|
||||
return result
|
||||
})
|
||||
}
|
||||
|
||||
export default function (eleventyConfig) {
|
||||
|
||||
Reference in New Issue
Block a user