3

I'm trying to build a basic landing page on GitHub pages using Hugo (version 0.44) and the hugo-sustain theme. But I struggle to understand how to organise content with Hugo.

This is the basic example site from the hugo-sustain theme:

exampleSite
  ├── config.toml
  ├── content
  │   ├── projects.md
  │   └── blog
  │       ├── creating-a-new-theme.md
  │       ├── go-is-for-lovers.md
  │       ├── hugo-is-for-lovers.md
  │       └── migrate-from-jekyll.md
  ├── data
  │   └── projects.yml
  └── static

Now I'd like a nice projects page, where I have images and/or text.

But with the hugo-sustain theme the actual text content and the project's descriptions are in the projects.yml file. But not in the projects.md as I'd have expected.

That means it will be a lot harder to encode content that will nicely compile as a static page.

I have found this workaround with getting static pages set up following this post. But is that really the best-practice approach? It feels quite messy and involved for just one simple page.

Jos
  • 1,732
  • 3
  • 19
  • 39
dvanic
  • 545
  • 1
  • 4
  • 17
  • I don't mean this unfriendly, but wouldn't it be easier to use another theme than `hugo-sustain` if you dislike how the theme works and how it organises content? What you're in effect asking is to re-organise the theme and its inner workings. That is a lot of work, and something that we cannot answer for you here on StackOverflow. You could try and contact the theme author, but other than that you'll likely have to re-write the theme yourself. Sorry for the bummer! – Jos Jul 25 '18 at 15:42
  • @JosKodify Thanks, and I think my question is more basic than that: I don't *dislike* how hugo-sustain is organising content, I'm trying to understand how it is supposed to work! I'm trying/thinking of migrating to it from Jekyll, and hence used to Jekyll's really easy "put your markdowns into the correct folder and magic happens" approach, and I'm just trying to understand whether the "use your left hand to scratch your right earlobe from behind your back" approach is really hugo's default model, or whether I'm just missing something bleedingly obvious, being a newbie to hugo! – dvanic Jul 27 '18 at 00:28
  • Ah I see. I don't use the `hugo-sustain` theme myself so can't say how that theme should organise its folders. Perhaps you can ask the theme author directly through its [repository](https://github.com/nurlansu/hugo-sustain)? I do see that the theme hasn't been updated in some time now. If you don't get a reply, I'm afraid the best thing you can do is inspect its code and use some trail and error. Good luck! – Jos Jul 31 '18 at 11:15

1 Answers1

0

Now I'd like a nice projects page, where I have images and/or text.

Generating pages from data in Hugo is currently not possible and will (most likely) not become possible in the near future: https://github.com/gohugoio/hugo/issues/5074

That means you have to create a section projects with .md files of each project. They will have their own layouts. The alternative is to use the trick from Regis (https://www.thenewdynamic.com/) where you run Hugo twice: once to transform data into .md files and once to render the .md files.

Mr. Hugo
  • 11,887
  • 3
  • 42
  • 60