SSG using my own code

This may sound obvious or silly to some, but throughout my research into SSGs over the past 6 months I’ve yet to determine how one might(can?) write their own code, update through git or whatever, and work with a SSG.

Every SSG site i visit is constantly pushing themes(Hugo included), writing everything in markdown, building on yaml file information, to the point that I don’t understand if it’s even possible to simply use my own html, css, and js to develop a site and deploy. Most advice is to just modify a theme… no, that’s not what i’m here for, I want to write my own site, thanks.

Silly? maybe, but I simply can’t find an answer to this seemingly obvious question.

Thanks very much, Hugo sounds great and I would love to get started. Baseline info is lacking in this area imo and I would appreciate your thoughts.

Thanks!

  1. The documentation is here: https://gohugo.io/documentation/
  2. The templates section has instructions on how to create templates
  3. SSG?

I don’t think Hugo “is for you”.

@davidsneighbour SSG = Static Site Generator.

@mike_g if you’re going to write all the HTML yourself, I don’t think you need a Static Site Generator. The philosophy behind SSG’s is to generate a static site (i.e. the HTML, CSS, and JS) from various components (markdown files, data files, templates, etc.). But if you’re generating it all yourself, then you don’t need a generator to do it for you.

2 Likes

I was gonna post what @funkydan2 said. Additionally, for our knowledge as web developers, what functionality are you looking for beyond handcoding your own files, @mike_g? :slight_smile:

Hi Mike,

it is always a matter of taste.

If you just need a set of styled HTML files with common header and footer, Server Side Includes may be enough.


Opiniated:

But Hugo provides a lot more functionality (and yet is an easy to use single binary piece of software): image and data precessing, multilingualism, shortcodes, markdown … And using markdown is one of the main reasons for me to use a SSG: Plain text files will be readable in 25 years, a WordPress database maybe not.

Building a site/theme from scratch is really easy. Most themes you find are too complex to understand what is really necessary.

Recently I read an article like „N reasons not to build your own SSG“, but I cannot find it now. I think it was on DEV.

This is my way to Hugo: PHP to include header and footer to HTML files → WordPress → Drupal → Jekyll → Middleman → Hugo—and I could’t be happier with Hugo.

2 Likes

With respect, You may have to better understand the philosophy behind a Static Site Generator.
I heavily use Hugo with my own vanilla html/css/js.

What hugo have to offer at the most basic point is a template layer above vanilla languages. Linked to whatever data-source you might consider best for you (.md, .json, .toml, .yaml…). Giving you a nice decoupled architecture between you views and your data :slight_smile:

It dramatically improves your development scheme an experience. Reducing errors, compressing time to market and gaining flexibility both for you and your clients (among some advantages).
I won’t talk about the scalability and ease of self hosting and serving static file since you already build static assets by hand.

IMO | Why hugo vs the others ?

I’ve been using a lots of static site generator by the past. Hugo really shines out of the crowd because it is BY FAR the fastest engine on market (based on go, native binaries exec). It runs natively on all OS. I used it simultaneously on GNU/Linux Debian and windows. It also provide a whole pipeline assets (transforming images, minification…) all at runtime and solid mental model based on folder hierarchy. And that’s just scratching the surface. Go template is easier to use for a website than say… React for example, but still have all the power needed (loop, func, conditions) and still CAN be enhanced and turned into a full progressive web app by those js Virtual DOM frameworks.

Conclusion is that Hugo provides exactly what you asked for. You just need to get use to a different way of building web things, which requires a little bit of patience :wink:

Cheers.
Thomas

3 Likes

Thanks, i appreciate it.

I suppose my question boils down to the necessity of point 2 - creating my own template. No problem, it just isn’t clearly enunciated anywhere that that’s the logical starting point to not use an existing template.

SSG === Static Site Generator

Thanks for this.

I guess I was hoping for was some of the ancillary benefits from using git, etc. alongside custom coding stuff as it pertains to SSGs. I think @davidsneighbour helped me out with simply creating my own template.

Thank you!

Got it, thank you!

Yeah i read that article too(the one about NOT using an SSG). If it’s the same one I read it came across as maybe the author not having actually tried SSG’s before, but I’m not sure.

Now I love MD so from others’ comments and yours it seems like simply creating my own theme is the way to do it, along with your other suggestions.

Merci!

1 Like

Thanks for that.

I’m glad to get your thoughts on this. I am completely sold on all the benefits you’re mentioning here, which is why I want to get to use SSGs, and I actually really DO like the idea of decoupling concerns as you mentioned.

I think the part that wasn’t clear was how to sidestep an existing theme and still get all those benefits, but I think the answer is clear to me now.

Thanks!

1 Like

You are welcome Mike.
You should start here https://gohugo.io/templates/introduction/
Write your own hello world template you will quickly get used to the go/html syntax, once you fully master this concept (coupling with the /content folder) it will be a breeze to build your own themes to reuse.

Side note: I never used a pre built theme on Hugo. I always built my own things :wink:

1 Like

@mike_g, what you want to do is what I also want to do and it took me a couple years of experimenting with many Hugo themes to finally realize that I do not want to use someone else’s theme, although I’ve learned a lot from them so thank you theme developers! I wrote https://www.ii.com/themeless-gitless-intro-hugo/ partly to learn Hugo and AsciiDoc, but mainly because it is what I wish I had read when I was getting started with Hugo. Maybe it will be helpful to you :smiling_face_with_three_hearts: