Time for another update…
Pages and posts
I’ve finally bit the bullet and reworked the posts system to incorporate a concept of “Pages” (for anyone familiar with wordpress, it’s the same as how wordpress delineates “posts” and “pages”). This feature was a real pain, not only because it was basically redoing work I had already done in posts, but because by editing this core functionality I risked creating new bugs in a stable system. You can see here the “Pages” in action:
In the end, I decided to entirely rip out the posts code and begin from scratch with a concept of generic Documents
, a post is a Document
, and a page is a Document
, but they have different rules governing how they work.
I ended up with a totally generic and re-usable system which only takes around 30 lines of boilerplate code to spin up a new document type. You can see here the code which runs the Pages
page:
And the code which runs the Page edit
page:
This is a really powerful system which I may consider exposing to theme authors in the future (so your theme could include a new Document
type, for instance, an e-commerce plugin / theme which included a new Product
document), so you can kind of see how the ridiculous amount of work it took to make all this functionality generic could pay off in the future as the greater ecosystem around Phantom expands.
Exposing theme config to the compiled websites
I’ve gone with the simplest method of exposing theme configuration to the frontend compiled websites: just spitting out a JSON object which theme authors can ingest.
Here you can see a partial output from a compiled website, with the vue / vue-router code, but if you look to the right of the script tag, you can see the theme configuration is exposed via a window.themeConfig
object. There’s not much more to say about this except that the feature is now complete.
Image uploader
The only real task I have left is exposing the image uploader I created yesterday to the posts / pages so that users can upload and manage images directly within documents. I expect this will actually take me a couple of days, so I probably won’t have an update for you tomorrow.
Personal
I’ve been trying to make at least one commit per day since I started working on this project. I harbour a lot of internal guilt about how the SafeCMS project ended, and I’ve been using those negative feelings as fuel to keep this project burning. Sometimes it can be hard to find the motivation to get out of bed, sometimes I’ll procrastinate for hours before forcing myself to open my IDE. Strangely, I get a lot of joy from seeing a new box turn from grey to green everyday in Github:
I always appreciate the compliments I get in this thread, but I rarely hit like unless there’s something in the reply which I want to action later. I think that’s a systemic issue that a lot of developers have: we seem unable to experience praise. We know the truth: the projects we’re working on aren’t that difficult, it’s just throwing some code at the screen and seeing what works. For the most part, we are our own worse critics - that’s a real issue and one we’re going to need to collectively overcome. Anyway, I was just throwing some thoughts out there on a cold and wet Sunday.