5 ms·
Why can't you do static generation from an online editor?
by Touche 13y ago
Why can't you do static generation from an online editor?
- Xylakant 13y agoBecause you need to write somewhere. Now, you can write to the filesystem if you really really want to, but only if there is a writable FS somewhere - so e.g. not on heroku - but in any case writing to the FS and then serving that document is a whole can of worms.
- Touche 13y agoActually what I want ideally is the admin interface to be a Node app. For drafts use sqlite. For scheduling use sqlite. When I hit publish I want it to generate static assets. The blog itself I don't need to be served by the Node app, Apache or Nginx can do that fine.
- Xylakant 13y ago> For scheduling use sqlite. Well, scheduling and static generation require a cron job that writes the static asset at the predefined time. It all gets complicated from here. You can write the static asset when it's first accessed for example and from there on serve the static file, but that requires a database/storage as well, so you're basically back to square one. I'd not restrict myself to sqlite here either, but that's a minor nitpick.
- Touche 13y agoWhy does it require a database? Ghost has a Markdown editor and presumable stores posts in the database as markdown, just write the markdown to the file system instead of a database? I'm really not seeing any requirement for a database here.
- Xylakant 13y agoWell, yes, you can write to the filesystem, that's why I'm saying "database/storage". See, heroku for example does not provide you with a writable filesystem and it's also easier to share a database over a couple of hosts than a filesystem. Also, if you want to schedule, you'll need to store the scheduling information somewhere. You can add it to the file itself, just as jekyll does but then you'll have to open all docs just to see if they need scheduling. Or you write a schedule-file, but by the time you're doing that you're effectively building a database. Why not go and use a "real" database adapter and use sqlite for all basic setups since basically, sqlite is a specially formatted file with a library providing useful abstractions on top.
- pingswept 13y agoYou can. I've done this using a different web editor based on CodeMirror: https://github.com/rascalmicro/red https://github.com/rascalmicro/red I do suspect that Xylakant may be right elsewhere in this thread when she points out that it's not possible on Heroku, but I'm not sure. Anyway, I would love to see Ghost use a pile of static Markdown files rather than a database for posts. Then, in a couple of years, when I want to use something else, I can take my pile of Markdown files and move along.
- deleted 13y ago[deleted]