Tips, patterns, approaches for migrating away from database-driven website

For quite a while now, I’ve been looking to migrate from CakePHP/MySQL-based implementation to a static-site generated approach, preferably Hugo. I’ve been racking my brain on how to leverage posts, front matter, and data files to represent some of the data type relationships. It’s a record label website, so it’s not terribly complex. Here are a few examples of data types and their relationships:

  • Bands: has many Releases, has many Members, has many Events
  • Release: has many Tracks
  • Tracks: belongs to many Releases, has many Bands
  • Event: has many Bands

Am I asking too much Hugo’s “Content Management” model?

Also, I have been looking at Contentful to manage the data/relationships and then generate the Markdown/down files as part of a CI step before I run Hugo to generate the site.

Any help or guidance would be appreciate. Just trying to find the right tool and approach for the job.

You can easily do this with JSON files:

{
        "Ancient Bards":
        {
            "active_since": "2006",
            "active": true,
            "albums": [
                "AncientBards/AllianceOfKings.json", "SoullessChild.json"
            ],
            "events": "AncientBards/events.json"
        }
 }

Then, in AllianceOfKings.json:

    
        {
            "name": "Alliance of Kings"
            "tracks":[
                "Song1",
                "Song2"
            ]
        }
   

And so on. It is a bit of work, but not impossible.
You can then load these into Hugo during generation.

I really appreciate the quick response. Let me play around with it and see how it goes. I might not need all those relationships going forward. It was a side project to learn CakePHP for I might have over designed the object relationships.

funnily enough, the Hugo docs example on data templates involves discographies. . . https://gohugo.io/templates/data-templates/#example-jaco-pastorius-solo-discography

depending on your data, taxonomies might also serve the purpose in some instances. https://gohugo.io/content-management/taxonomies. But in this case you’re going to have to get away from thinking in “relational db” terms and work with intersecting content hierarchies instead.

I took a look at that example, but it didn’t seem to map well to what I was doing. I’ll take another look at the taxonomy page. Thanks for the suggestion!