Sorry that this is a really long post and pre-emptive apologies for terrible run-on sentences rife with parentheticals.

Hello Gentlepeople of Statamic.

I have been working on a site for my film production company, the Kitchen. I have absolutely loved working with Statamic. Coming from a previous site built on Jekyll and having developed a few sites with Craft (and quite a few on ExpressionEngine before that, when I used to do this for a living), Statamic represents Hope for me: That there might actually be a best-of-all-worlds CMS. Eventually.

Right now, I'm having a lot of trouble with something that I suspect wouldn't be too difficult to develop an add-on for, or build right into the core, and I can't see how many people wouldn't be running into this same issue.

Before you say "write the add-on yourself," I know. I know. I'm sorry. I can't. I won't. I'm not a developer or a designer. I only pretend to be when I'm building my own sites. I'm a filmmaker, and that's my job, and I don't have time for a second job right now. This whole post may only convey that I'm just dumb and that I do everything wrong and why don't I just go crawl in hole with my non-contributing self and die, but I have to say that with both Craft and EE, I have usually been pretty easily able to figure out how to pull off any old convoluted thing I wanted to do (and I am forever coming up with these things, I swear, give me any piece of software to accomplish any task, and within an hour, I will find the one thing that I want to do that won't work, at least not easily, or so it seems.)

So in Statamic, as in life, the thing that has me pulling my hair out is relationships. I was, to put it mildly, extremely discouraged when on Twitter, the leadership said they didn't think related entries "would ever be something we're the best at," due to "the nature of flat files."

This hit me like a ton of bricks. My heart sank. I feel like I just saw my own mother kissing a stranger. My life passed before my eyes.

I think this is aiming way too low.

Call me crazy, but I think the promise of Statamic is that we can do the things we want without having to deal with a big stupid database blob. Files and file-systems are perfectly suited to hold data. They are human-readable and machine-readable. Why wouldn't they be? If unique keys are required, fine. Why couldn't a file contain a unique key? We have _uid, don't we? Actually, that _uid "field" is already a betrayal of the human-readable aspect of a flat-file CMS, and I tend not to agree with it. A URL (filename) actually makes for a marvelous unique key in web development in my humble opinion, especially when you consider that URLs are supposed to be permanent and unchanging anyway. That encourages good web practices, and it's 100% more readable than actual unique keys. And if it's just too damned scary for you, throw an id number in the URL that can't change and doesn't show in the browser. I don't know. Or if you want to stay away from the filenames, let us write our own unique key, that we can read. How hard is that? We do it every day all the time when we are creating files and crap.

It feels arbitrary to me. Sure, a url or username could be changed, but so could a unique key. The only reason a unique key doesn't change is because we call it a unique key and say "Don't touch that!". Well we should frankly be saying the same thing about our URLs (or usernames, or what have you). And in the rare case where we had to take the drastic action of changing one of those things after it was already referenced throughout our system, well, that's what find/replace is for. That's like 1/73rd of the reason that I love working with flat-files. And that's significant. Am I alone here?

So what I'm saying on the unique ID issue is that I think the only reason that we have this scaredy-cat attitude about it is because we're still influenced by our days in a relational (and inscrutable) database land. It's just a cultural thing. We need to learn and just accept that it isn't the primary_key column in a database that you don't mess with, it's our filenames, which stay unique by file-system law, which we can read, and hey, if they get borked, a text editor is all we need to fix them.

So, in practical terms, here's what I want to be able to do, all the time, everywhere, and I'd be shocked if this isn't something others want to do.


{{ entry_chosen_from_suggest_field }} {{ any_piece_of_data_i_want_from_referenced_entry }} {{ /entry_chosen_from_suggest_field }}

I know about {{ get_content src="{ value }" }}{{ thing_from_entry }}{{ /get_content }}, and that's all well and good (if maybe a little too much template code and a little clunky, in my humble opinion), but this breaks down quickly, because you can't nest it. Nesting these types of tags is awesome, of course, because it opens up virtually limitless possibilities for relating entries. And this can all happen without adding a whole bunch of new data to a file. They can be related by their keys, just like things are related in a database, but with way more freedom, because we can save any old array or string or whatever in our yaml anywhere we want.

Another note, on users (members?). Why shouldn't these files be reference-able like any other files? Why does this folder have to be separate and exclusive? Again, there's probably a good reason for this that I just don't get because I'm a viking, but it would seem to me that the flexibility that most of us are used to having, coming from this side of the CMS world (the oh-my-god-let-me-write-my-own-markup-and-template-code-are-you-serious-right-now side, the software-costs-money-because-time-has-value-jackass side, the wordpress-and-drupal-make-blood-shoot-from-my-eyes side, et al.) would include the ability to grab a piece of data from a user file the same way we can from anywhere else. This is especially frustrating for something like a Bloodhound search where I want to be able to search and display my members' profiles in search results (logically). And the member folder is just a folder of flat files, like everything else... Why can't I search that? And while we're on Bloodhound, if Bloodhound can search the {{ content }} field (I know it's not recommended, but... lezbehonest, it's defaulted "true" for a reason...), which is a field like any other field (with the nice distinction of being the only field that doesn't need to live in the yaml front-matter, which I love), why can't it look through the rest of the text in that text file? The data in the front-matter? I'm storing tons of great data in that front matter, of course, great and relevant data, and it certainly couldn't be more resource-intensive to crawl that text as well when we're searching, could it? What am I missing here?

I digress.

So I'm not proposing that every file should be bloated with data or mucked up with machine-junk. Quite the contrary. I'm simply saying that I should be able to reference another file within a file and then get that file's data, and then I should be able to reference files referenced by that file, and then a user referenced in that file, and so on. And even though this creates resource-intensive queries (shudder), that's what cache is for. Oh, and cache should be configurable per directory.

Ugh, again, I digress.

And while we're at it and getting frisky, why not let our tags have access to any folder, in any place that doesn't need to be swapped out on updates? Why limit this? These are files, with text in them. These represent permanence and solidity and freedom and openness and lightness and poetry and prose and god-damned unicorns prancing through cloud-meadows.

I'm deeply sorry for this.

The Statamic that already exists is so damned close to all this. It's like all the code's already in there and written, all the nice furniture is arranged and ready to sit on, but somebody has covered it all with dingy sheets because they are afraid we'll spill rootbeer on it or write on it with crayons.

Statamic is the fulfillment of a dream, of destiny itself.

So, my question to the amazing people working on Statamic is, in the words of the great Christian Slater, staring intensely into Kevin Costner's eyes: "What I want to know brother, is will you stay with us and finish what you started?"

Or will you decide that flat files are limited and therefore we should be thinking in a limited way about what kinds of sites we can "pull off" with flat files. I know that's not the reason Statamic exists. I just know it. No one went to this much work to create something this beautiful only to stop at {{ get_content }}.

I'm so sorry for this post, you guys. I just, I couldn't sleep until I said something. Bless you all.