Probably fixed episode guide with redir to official HMH guide

This commit is contained in:
Asaf Gartner 2024-07-07 13:34:00 +03:00
parent 4be6e89298
commit e06666a570
2 changed files with 12 additions and 2 deletions

View File

@ -24,10 +24,10 @@
{{ range .Topics }} {{ range .Topics }}
{{ if .Url }} {{ if .Url }}
<li class="ttc"> <li class="ttc">
<a href="{{ .Url }}">{{ .LinkText }}</a> <a href="{{ .Url }}">{{ .Username }}</a>
</li> </li>
{{ else }} {{ else }}
<li class="ttc"><strong>{{ .LinkText }}</strong></li> <li class="ttc"><strong>{{ .Username }}</strong></li>
{{ end }} {{ end }}
{{ end }} {{ end }}
</ul> </ul>

View File

@ -55,6 +55,11 @@ func EpisodeList(c *RequestContext) ResponseData {
return c.Redirect(c.UrlContext.BuildHomepage(), http.StatusSeeOther) return c.Redirect(c.UrlContext.BuildHomepage(), http.StatusSeeOther)
} }
if slug == "hero" {
// NOTE(asaf): Manual override for HMH
return c.Redirect(fmt.Sprintf("https://guide.handmadehero.org/%s", topic), http.StatusSeeOther)
}
if topic == "" { if topic == "" {
return c.Redirect(c.UrlContext.BuildEpisodeList(defaultTopic), http.StatusSeeOther) return c.Redirect(c.UrlContext.BuildEpisodeList(defaultTopic), http.StatusSeeOther)
} }
@ -116,6 +121,11 @@ func Episode(c *RequestContext) ResponseData {
return c.Redirect(c.UrlContext.BuildHomepage(), http.StatusSeeOther) return c.Redirect(c.UrlContext.BuildHomepage(), http.StatusSeeOther)
} }
if slug == "hero" {
// NOTE(asaf): Manual override for HMH
return c.Redirect(fmt.Sprintf("https://guide.handmadehero.org/%s/%s", topic, episode), http.StatusSeeOther)
}
_, foundTopic := topicsForProject(slug, topic) _, foundTopic := topicsForProject(slug, topic)
if foundTopic == "" { if foundTopic == "" {
return FourOhFour(c) return FourOhFour(c)