oleeskild / obsidian-digital-garden

MIT License
1.36k stars 124 forks source link

How to add serverless functions? #569

Closed rubenrivera closed 6 months ago

rubenrivera commented 6 months ago

I'm new to Eleventy, so I would like to know if adding serverless function support is possible by only editing src/helpers/userSetup.js and src/helpers/userUtils.js.

I'm looking for options to add authentication to digital gardens. I found a demo about using OAuth on Eleventy that showcases the Eleventy Serverless plug-in, so it looks plausible. After some days, I found a way, but it required me to edit files other than the ones mentioned above:

I edited the notes.11tydata.js file to make the permalink property an object, as the Eleventy Serverless plugin requires. This was enough to run the site locally using netlify-cli. Still, when pushing the changes to GitHub, the command favicon on components/pageheader.njk was causing problems. I added a condition to skip this command when the serverless function generated the page.

Is it possible to make the permalink property an object for a few notes, let's say having the "private" tag, by customizing only src/helpers/userSetup.js and src/helpers/userUtils.js?

References