Almost There
Man, I was feeling so good about this last week, I thought I was going to fly into the weekend with all my new solutions and things were just going to fall into place.
Yeeaaah that would have been nice.
Instead I spent all weekend figuratively beating my head against a wall. We're at the point where all of Eleventy's out-of-the-box solutions no longer work for my site setup, but I'm also not nearly familiar enough with coding to do anything other than tell the AI what I'm trying to accomplish and look at what it spits out with a frown. Honestly, if you're around my own skill level, you're really better off designing your site to conform to Eleventy's templating & layout system, rather than the other way around. It bills itself as "customizable", but every customization I've needed to implement has mostly just felt "hacky".
Layout
So, I thought it would be easy to use shortcodes to plug in HTML tags where I needed them to form the sections in my layout. And it was... up to the point I realized that the page navigation at the bottom was interfering with my ability to close </main>
. In the layout, they fell right between my content and my closing tag. They'll get inserted right after any content from the template, which in some cases, is going to be my sidebar.
I thought I could just put the navigation code in the shortcode so that it gets inserted, but Eleventy can't pull navigation resources from the template unless they're explicitly passed in the statement that calls the shortcode. Well, I wanted the template to be easy and I didn't want to have to type out the same three resources to pass over on every template, so I gave up on that approach.
I mentioned before about a potential solution involving HTML comments, and that's what I ended up going with. I can use shortcodes in the template to insert comments like <!--MAIN_START
and MAIN_END-->
. Then, when the content gets passed over to the layout, I have code which uses these comments as delimiters to split the whole block into different pieces, which get saved as variables and called where in the layout I need them. Not exactly pretty, but it works.
Layout
I was likewise very pleased when I realized I didn't have to set up an additional subfolder to make the data directory files work with my content, I just needed to replace the front matter content in the index file. Or so I thought.
However, because I was trying to be clever with my breadcrumbing and using EleventyCompute to generate the keys and parents from other items, I ran into multiple issues involving the front matter of the index file not having those items defined (because it didn't need them) or overwriting the key and parent I'd specified. I now have code in the directory file specifically to handle the index.
The most annoying of my problems was realizing that, even if I tagged the index differently than the directory file so that my collections would be how I wanted, it would add the tag from the file to the index anyway, so the index was now in two collections... one of which was the items it was supposed to contain, so the index was now listed in its own table of contents. Which, by the way, was not always how Eleventy worked; it used to simply do the replace that I was expecting, but in a later version opted for an add instead, with no obvious way to toggle between these two. Spent a lot of time trying to figure out how to get that to stop happening before I looked at Eleventy's documentation and saw it had a specific line to exclude a page from a collection. Really easy fix, wish I'd seen that a lot sooner.
RSS
Eleventy has a plugin that seems to work pretty decently out of the box. But I am a perfectionist, and "pretty decently" doesn't cut it for me. I didn't want the plugin to be pulling in all my sidebar content and navigation links and things into every RSS post. So I had to make my own RSS template.
Which, actually, still not as bad as I expected. But boy, I really wanted to get the full (main) content of my pages so you could read them exclusively in your RSS reader if you wanted to, and I just could not do it. My custom solution for layouts I listed above had the side effect of splitting up my tags, and based on when content was actually passed to the RSS plugin, not everything was being opened or closed as appropriate. After finding no good fix to this, I just opted to pull in the first paragraph from each page and stick in a link to read the rest on the site.
This doesn't even work on my preferred reader Feedbin since they apparently sanitize HTML, so my links just show up as plain text there (although I still can't figure out why the feed for Ars Technica works okay. Maybe I just haven't reached their level of renown yet). Whatever, I'm kind of over it at this point. It's fine, ship it.
Which Means
Oh baby, it's time. It's finally time. I can start converting all my pages over to the new format. Leave this behind:
...and move to this:
And I'll have the ability going forward to actually generate these posts in Markdown if I want, only using HTML tags where I need to for edge cases—some of which I might be able to simplify with more shortcodes. Won't have to mess with links or nothing. Oh it's going to be so good.
I'd better get moving on that though because I have drafts for like three other things that are on pause right now because I'm spending all my time fiddling with this.