👔 Fixed resources filters in Page and Site use cases
This commit is contained in:
parent
dd9cc5b2d1
commit
db68a8d768
|
@ -54,12 +54,14 @@ func (ucase *pageUseCase) Do(ctx context.Context, lang language.Tag, p string) (
|
|||
return out, nil
|
||||
}
|
||||
|
||||
for j := range out.Files {
|
||||
if ext := out.Files[j].Ext(); ext != ".html" && ext != ".md" {
|
||||
for j := 0; j < len(out.Files); j++ {
|
||||
if ext := out.Files[j].Ext(); ext != "html" && ext != "md" {
|
||||
continue
|
||||
}
|
||||
|
||||
out.Files = slices.Delete(out.Files, j, j+1)
|
||||
|
||||
j--
|
||||
}
|
||||
|
||||
return out, nil
|
||||
|
|
|
@ -3,6 +3,7 @@ package usecase
|
|||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"slices"
|
||||
|
||||
"golang.org/x/text/language"
|
||||
|
||||
|
@ -29,7 +30,17 @@ func (ucase *siteUseCase) Do(ctx context.Context, lang language.Tag) (*domain.Si
|
|||
return nil, fmt.Errorf("cannot find base site data: %w", err)
|
||||
}
|
||||
|
||||
out.Files, _, _ = ucase.statics.Fetch(ctx, ".")
|
||||
if out.Files, _, err = ucase.statics.Fetch(ctx, "."); err == nil {
|
||||
for i := 0; i < len(out.Files); i++ {
|
||||
if ext := out.Files[i].Ext(); ext != "html" && ext != "md" {
|
||||
continue
|
||||
}
|
||||
|
||||
out.Files = slices.Delete(out.Files, i, i+1)
|
||||
|
||||
i--
|
||||
}
|
||||
}
|
||||
|
||||
sub, err := ucase.sites.Get(ctx, lang)
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in New Issue