Hi all,
I’m writing a lot of ExpressionEngine related guides and content at the moment in Typora (a great markdown editor). When the content goes live (soon I hope) I have to copy/paste the body text from Typora, into a new EE entry with a markdown formatted textarea field.
This works great, but also means that any changes will have to be made in Typora first, and then copied over — even small typo corrections and such.
Is there any way I could have the markdown files on the server, and have them auto-update the entries? Exactly like Templates work, where you first create a template in EE, it’s then available on the server as a file, and any changes made to this file is reflected on the site when you save.
Does such a system exist already? If not, perhaps an add-on could be made, or it could be a feature of ExpressionEngine in the future?
I could see it working in a couple of ways:
/system/user/markdown/
and any .md file you create there would create a new, closed entry in EE, with the markdown as the body of the entry. You could then add any images, categories and so on you want, and then publish when it’s ready. After that, any changes to the .md file updates the entry and thus is reflected online.Or you could do the reverse, which I think I actually prefer:
This would enable you to write your content in any editor you like, and work on your content as much as you want, having it just a click away from going online. And when online, any changes would be reflected instantly.
Because as great as the EE UI/UX has gotten (and it has gotten really great with EE 6) I think most people like to write longer entries in a real editor, if given the chance.
I’m nowhere close to being able to create an add-on myself, and I haven’t been able to find a solution that makes the above possible at the moment. So if anyone wants to take this on, I’d love to beta-test it with you, or be involved in any way. Other than that, the idea is free to run with 😊
Cheers,
Thomas
Hi Tom,
Great to hear you like the idea 👍 😄
I did a bit of research, and a quick google search for “blog posts from markdown files on server” gave lots of links to projects that might serve as inspiration or starting points. For example this Github called simply Markdown Blog looks a whole lot like what I’m after, sans the EE integration.
Quote:
> Extremely simple “static” PHP blog that renders markdown posts. No installation or database needed.
>
> To create a post just write a new .md
file. Everything else just works.
>
> Note: It’s not a full blogging platform, does not currently come with any premade themes, it’s just a script and specific folder structure to load and display markdown files.
Anyways, there are lots of other projects like this, and integrating something similar into EE — which already has the “load from files to update database” functionality for Templates — might be pretty easy. Which … is easy to say, when it’s not you who has to code it, I know 😉
Cheers, Thomas
PS: The quote above doesn’t seem to render correctly, event though the markdown formatting should be correct, at least from here in Safari under macOS 11.2?
Hi everybody,
Great news! I’ve managed to put together a solution to my wish, of having ExpressionEngine pull content from Markdown files on the server, directly into entries, and have the site update when changes are made to those files!
See my original post at the top, for my thoughts on why this would be cool.
Here is a short reap of how it’s done:
While not particularly elegant, it’s working great and it’s not too difficult to set up. Of course having this functionality baked right into EE (or as an add-on) would still be pretty awesome, and I hope it will be at some point.
Anyways, I wrote a setup-guide and put it in a GitHub Wiki, because it grew too big to post here. Feel free to share your improvements and comments!
Links to setup-guide:
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.