Repository navigation
Expand file tree
/
Copy pathpage.go
More file actions
80 lines (67 loc) · 1.83 KB
/
Copy pathpage.go
File metadata and controls
80 lines (67 loc) · 1.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
package model
import "time"
const (
customListPageID string = "index"
)
// Tag is used for grouping pages with similar content.
type Tag struct {
Name string
Href string
}
// String implements the Stringer interface and allows
// accessing the name field directly in templates without calling .Name
// which preserves backwards compatibility with older versions.
func (t Tag) String() string {
return t.Name
}
// Page represents a sub-page of the website.
type Page struct {
Route string
ID string
Href string
Title string
Author string
Date time.Time
Tags []Tag
Img string
Credit string
Description string
Content string
Related []*Page
Type *Type
Hidden bool
Meta map[string]string
providedRelated []string
providedType string
}
// IsCustomListPage returns whether the page is a custom list page that has
// been created from a file called index.md in a content directory.
func (p *Page) IsCustomListPage() bool {
return p.ID == customListPageID
}
// ProvidedRelated returns all Fully Qualified Name URIs related to the page.
func (p *Page) ProvidedRelated() []string {
return p.providedRelated
}
// AddProvidedRelated adds a new Fully Qualified Name URI to the page.
func (p *Page) AddProvidedRelated(relatedFQN string) {
p.providedRelated = append(p.providedRelated, relatedFQN)
}
// ProvidedType returns the user-provided page type.
func (p *Page) ProvidedType() string {
return p.providedType
}
// SetProvidedType sets the user-provided page type.
func (p *Page) SetProvidedType(providedType string) {
p.providedType = providedType
}
// ListPage represents an overview page that is generated for
// each content sub-directory.
type ListPage struct {
Page
Pages []*Page
}
// Type represents a page type.
type Type struct {
Template string
}