ndex file not in category list; index file redirects to category
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
4080d7992f
commit
a588e6e573
3 changed files with 7 additions and 1 deletions
|
@ -19,3 +19,6 @@ __DONE__
|
||||||
* migrate to gRPC
|
* migrate to gRPC
|
||||||
* routing, not found
|
* routing, not found
|
||||||
* template engine
|
* template engine
|
||||||
|
* all other languages under sgs
|
||||||
|
* index file redirects to category
|
||||||
|
* index file displayed as intro to category
|
||||||
|
|
3
main.go
3
main.go
|
@ -133,6 +133,9 @@ func process(_ context.Context, w gemini.ResponseWriter, r *gemini.Request) {
|
||||||
renderSearch(lang, w, r, client)
|
renderSearch(lang, w, r, client)
|
||||||
case regexp.MustCompile(`^/(sgs|en)/f/?$`).MatchString(r.URL.Path):
|
case regexp.MustCompile(`^/(sgs|en)/f/?$`).MatchString(r.URL.Path):
|
||||||
renderAllFiles(lang, w, client)
|
renderAllFiles(lang, w, client)
|
||||||
|
case regexp.MustCompile(`^/(sgs|en)/f/([\p{L}\d_+.]+/)+[\d\w]+/index.gmi$`).MatchString(r.URL.Path):
|
||||||
|
urlParts := strings.Split(r.URL.Path, "/")
|
||||||
|
w.WriteHeader(gemini.StatusPermanentRedirect, strings.Join(urlParts[:(len(urlParts)-2)], "/"))
|
||||||
case regexp.MustCompile(`^/(sgs|en)/f/([\p{L}\d_+.]+/)+[\d\w]+/[\p{L}\d_+.]+.gmi$`).MatchString(r.URL.Path):
|
case regexp.MustCompile(`^/(sgs|en)/f/([\p{L}\d_+.]+/)+[\d\w]+/[\p{L}\d_+.]+.gmi$`).MatchString(r.URL.Path):
|
||||||
renderFile(lang, w, r, client)
|
renderFile(lang, w, r, client)
|
||||||
case regexp.MustCompile(`^/(sgs|en)/f/[\p{L}\d_+.]+(/[\p{L}\d_+.]+)*/?$`).MatchString(r.URL.Path):
|
case regexp.MustCompile(`^/(sgs|en)/f/[\p{L}\d_+.]+(/[\p{L}\d_+.]+)*/?$`).MatchString(r.URL.Path):
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
🌙 {{ indexFile.File.Created}}
|
🌙 {{ indexFile.File.Created}}
|
||||||
{{ indexFile.File.Copyright }}{% endif %}
|
{{ indexFile.File.Copyright }}{% endif %}
|
||||||
|
|
||||||
{% for file in tree.RootFiles %}{{ text_url(lang, file) }}
|
{% for file in tree.RootFiles %}{% if file.Name != "index.md" %}{{ text_url(lang, file) }}{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% if tree.Categories %}### {% if lang == "sgs" %}Kateguorėjės{% else %}Categories{% endif %}
|
{% if tree.Categories %}### {% if lang == "sgs" %}Kateguorėjės{% else %}Categories{% endif %}
|
||||||
{% for cat, count in tree.Categories %}{{ category_url(lang, tree.Path|add:"/"|add:cat, cat, count) }}
|
{% for cat, count in tree.Categories %}{{ category_url(lang, tree.Path|add:"/"|add:cat, cat, count) }}
|
||||||
|
|
Loading…
Reference in a new issue