🏷️ Added IsHome property for Page domain

This commit is contained in:
Maxim Lebedev 2023-11-10 09:41:47 +06:00
parent 88e0dd02e9
commit ea040738b4
Signed by: toby3d
GPG Key ID: 1F14E25B7C119FC5
2 changed files with 3 additions and 0 deletions

View File

@ -9,4 +9,5 @@ type Page struct {
Title string
Content []byte
Resources Resources
IsHome bool
}

View File

@ -4,6 +4,7 @@ import (
"context"
"fmt"
"io/fs"
"strings"
"github.com/adrg/frontmatter"
"golang.org/x/text/language"
@ -66,5 +67,6 @@ func (repo *fileSystemPageRepository) Get(ctx context.Context, lang language.Tag
Description: data.Description,
Params: data.Params,
Resources: make([]*domain.Resource, 0),
IsHome: strings.HasPrefix(index, "index.") && strings.HasSuffix(index, ".md"),
}, nil
}