Skip to content

Commit

Permalink
Fix new notes with images
Browse files Browse the repository at this point in the history
  • Loading branch information
qubyte committed May 11, 2024
1 parent 41da7c0 commit 427fc62
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
10 changes: 4 additions & 6 deletions content/notes/1715358630528.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
{
"type": "entry",
"content": "One of the best things about living in Brighton (UK) is the density of pubs.",
"photo": [
{
"alt": "A mostly empty pint of beer on a table in the foreground. The photo is looking out of a pub window, at a pub across the street.",
"url": "/images/1715358532371.jpeg"
}
],
"photo": {
"alt": "A mostly empty pint of beer on a table in the foreground. The photo is looking out of a pub window, at a pub across the street.",
"value": "/images/1715358532371.jpeg"
},
"location": {
"type": "geo",
"longitude": -0.1138611666666667,
Expand Down
4 changes: 2 additions & 2 deletions lib/load-note-files.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ export default async function loadNoteFiles({ baseUrl, dir, imagesDimensions })
const content = render(note.content);

const photos = await Promise.all((note.photo ? [].concat(note.photo) : []).map(p => {
const { value, alt } = typeof p === 'string' ? { value: p, alt: note.content } : { ...p };
const { value, url, alt } = typeof p === 'string' ? { value: p, alt: note.content } : { ...p };

return composePicture(value, null, alt, imagesDimensions);
return composePicture(value || url, null, alt, imagesDimensions);
}));

return new NotePage({
Expand Down

0 comments on commit 427fc62

Please sign in to comment.