Maybe a product of my snowflake workflow with this; but when there is a section that doesn't map to any photos, the header will still be shown on the generated page.
[[section]]
title = "My Empty Section"
folder = "./media/nothing"
slug = "empty"
This will still show "My Empty Section" inlined in the site, in my case it's desirable to not have it show up at all. I pre-populate my foto.toml with a number of sections and essentially generate the output site on a cronjob/trigger whenever new photos get uploaded.
I've worked around it for my own purposes with a rather simple (and probably poorly thought out) patch that's done the job for my purposes:
From 36d1de95ab125beb142ced1a0f9605dacdf7f903 Mon Sep 17 00:00:00 2001
From: fkxr <f@fkxr.io>
Date: Sat, 27 Jul 2024 20:52:19 +0200
Subject: [PATCH] omit empty folders from generating headers
---
internal/indexer/indexer.go | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/internal/indexer/indexer.go b/internal/indexer/indexer.go
index 25ce94f..44f067a 100644
--- a/internal/indexer/indexer.go
+++ b/internal/indexer/indexer.go
@@ -55,7 +55,9 @@ func Build(metadata []config.SectionMetadata, option config.ExtractOption) ([]Se
}
slugs[slug] = true
- sections = append(sections, s)
+ if (len(s.ImageSets) > 0) {
+ sections = append(sections, s)
+ }
}
return sections, nil
But perhaps it's something to consider solving more properly.
Maybe a product of my snowflake workflow with this; but when there is a section that doesn't map to any photos, the header will still be shown on the generated page.
This will still show "My Empty Section" inlined in the site, in my case it's desirable to not have it show up at all. I pre-populate my
foto.tomlwith a number of sections and essentially generate the output site on a cronjob/trigger whenever new photos get uploaded.I've worked around it for my own purposes with a rather simple (and probably poorly thought out) patch that's done the job for my purposes:
But perhaps it's something to consider solving more properly.