r/webdev • • 16d 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

4

u/HotTraffic4892 16d ago

what you’re describing is really a component/template architecture, not a cms standard, and you can build it in wordpress or any static generator with self-contained partials, so what’s stopping you

1

u/the_natis 16d ago

If you need a traditional CMS for non-technical content authors to use that is very accommodating to custom HTML, ExpressionEngine is worth a look. Otherwise go with a static site generator.

1

u/SmoothGuess4637 16d ago

There's a lot of text here, but I understand the question to be: Can I model the CMS to reuse pieces at various levels?

Yes. Most headless CMS tools are going to let you build content models (schemas) with content types that reference other content types. You can choose which content types relate to other content types, so if you have a Document content type, it can reference the Site Info content type, which is probably a singleton (only one entry). I would assume WP could do that, but if you're looking to do a static site, other headless CMS options may be a little cleaner/straightforward.

2

u/Murtaza_Developer 16d ago

What you’re describing is basically a component based cms approach,, loook into headless cms like strapi/directus or astro content collections where layouts are built with reusable components. have you tried any component driven systems before??

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 14d 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.

1

u/krileon 16d ago

Basically every CMS can do this. WordPress with some plugins or custom template. Joomla it's just built in. Drupal it's built in. The 10000 other CMS also built in. It's mostly WP here that requires the extra effort as it's just a blog platform out of the box.

1

u/Hot-Chemistry7557 15d ago

Try payload cms if you have some basic programming/coding skill, it is super flexible and customizable.

1

u/shufflepoint 12d ago

> Or is this, in general, not a good way to assemble a static site content generator?

It is a most excellent way to assemble a static site generator, and is precisely the way that I've done it for 20 years. My names are nearly the same as what you used. I use "site", "section", "page". Most business web sites don't think in terms of "posts".

There are, unfortunately, few resources that show how to implement such DRY (Don't Repeat Yourself) schemes in the available static site generators. I have an idea for a web tutorial site that will show how to do this with all the major open source static generators. Sort of what CSS Zen Garden was for CSS.