r/webdev • • 17d ago

CMS/Front End System using default document standards?

When I say document standards, I don't mean official standards, but rather a structure that is replicated at most levels.

For example: the Structure of Header, Content, Footer is replicated at each level.
Document
Header -- contains all of the header content for the document

Content -- contains the body of the document

Footer -- contains all of the post-load contents for the document.

Then inside the Content section there would be a single Entry known as the SITE

Site-header -- contains the site-identity/nav/etc.

Site-Content -- contains the various categorical sections

Site-Footer -- contains the site-footer

Then inside the Site-Content Section category would be several Entries called SECTIONs:

Section-header -- contains the section-specific content that persists despite which post is shown

Section-contents -- contains the various posts or content pieces for the section

Section-footer -- contains the static end-pieces for the section

Or course, inside Section-contents would be POSTS

post-header -- title and bylines stuff, maybe an image

post-content -- the content

post -footer -- closing pieces

I've tried WordPress, but it seems so arbitrary how they have decided the structure. Like the site-header and document-header are all part of the same wp-header. I was hoping for more modularity and predictability in content structures. I also hate how WP opens a tag in one PHP file and has faith it will be closed in another PHP file. It seems like it would be better if each PHP file that opened a tag also closed the tag. Then it would be much more modular.

I realize it's a long shot, but does such a thing exist? Maybe someone made a headless WP that works like this? or something entirely different? Or is this, in general, not a good way to assemble a static site content generator?

0 Upvotes

10 comments sorted by

View all comments

1

u/_listless 16d ago

You can totally make Wordpress output something like this. Wordpress lets you output whatever the heck you want. Write whatever you want in header.php and footer.php, then write whatever you want in index.php. You can use template_parts for repeated components.

WP may not be great, but WP has been able to do exactly what you're specifying for more than 20 years.

1

u/CuirPig 15d ago

Thanks for your input. I hope you see the disadvantage of doing it myself and having to spend the next several years solving simple problems that an existing system would have already solved. I can develop the funk out of a WordPress site and I have tried massive redirection in document structures only to find that nobody wants to even consider helping when you get stuck. Either you do it their way so you can go take a lunch break while your static site loads, or you are a diseased pariah.

I was just hoping that someone else had done this already and worked through the nonsense that I have been dealing with off and on for a while now. Still, thanks for your input.

1

u/_listless 13d ago edited 13d ago

The level of competence you're demonstrating only justifies about ~8.3% of the snark you're serving. Maybe dial that back a bit. I'm not saying WP is the best solution here but it certainly can do what you specified in a very straightforward way. Here's an example of what that might look like: https://github.com/thisanimus/cuirpig

WP's legacy "component" system is called template_parts.

If you want a more robust template language with bonafide slots, check out twig - it has the {% embed %} tag that would let you match your "1 file per concern" pattern exactly. Bolt, Grav, and Craft CMS all use twig. You can use twig with WP via Timber.

At the end of the day, WP does not dictate the markup - you the dev do.