~artemis/cap

919fd21d7c7bcb22726a790a240c6f20928a1849 — Artemis 1 year, 9 months ago 3d254d3
fix: Using a section's slug to find it instead of hacky permalink

Windows issues: the path separator between linux and windows is different.
This usually doesn't pose an issue, except in this kind of usage.
1 files changed, 2 insertions(+), 2 deletions(-)

M templates.go
M templates.go => templates.go +2 -2
@@ 41,10 41,10 @@ func GetRootSection(section *domain.Section) *domain.Section {
}

// GetSubsection takes a name, and a section, and tries to get a subsection with the given name.
// The section name corresponds to the section's permalink, trimmed to its base name (e.g. /test/abc-def's section name is abc-def).
// The section name corresponds to the section's slug (e.g. /test/abc-def's section name is abc-def).
func GetSubsection(name string, section *domain.Section) *domain.Section {
	for _, sub := range section.Subsections {
		if subName := path.Base(sub.Permalink); subName == name {
		if sub.Slug == name {
			return sub
		}
	}