forked from kabukky/journey
-
Notifications
You must be signed in to change notification settings - Fork 0
/
helperfunctions.go
92 lines (80 loc) · 2.35 KB
/
helperfunctions.go
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
81
82
83
84
85
86
87
88
89
90
91
92
package templates
import (
"github.com/kabukky/journey/structure"
)
var helperFuctions = map[string]func(*Helper, *structure.RequestData) []byte{
// Null function
"null": nullFunc,
// General functions
"if": ifFunc,
"unless": unlessFunc,
"foreach": foreachFunc,
"!<": extendFunc,
"body": bodyFunc,
"asset": assetFunc,
"pagination": paginationFunc,
"encode": encodeFunc,
">": insertFunc,
"meta_title": meta_titleFunc,
"meta_description": meta_descriptionFunc,
"ghost_head": ghost_headFunc,
"ghost_foot": ghost_footFunc,
"body_class": body_classFunc,
"plural": pluralFunc,
"date": dateFunc,
"image": imageFunc,
// @blog functions
"@blog.title": atBlogDotTitleFunc,
"@blog.url": atBlogDotUrlFunc,
"@blog.logo": atBlogDotLogoFunc,
"@blog.cover": atBlogDotCoverFunc,
"@blog.description": atBlogDotDescriptionFunc,
// Post functions
"post": postFunc,
"excerpt": excerptFunc,
"title": titleFunc,
"content": contentFunc,
"url": urlFunc,
"post_class": post_classFunc,
"featured": featuredFunc,
"id": idFunc,
"post.id": idFunc,
// Tag functions
"tag.name": tagDotNameFunc,
"tag.slug": tagDotSlugFunc,
// Author functions
"author": authorFunc,
"bio": bioFunc,
"email": emailFunc,
"website": websiteFunc,
"cover": coverFunc,
"location": locationFunc,
"author.name": authorDotNameFunc,
"author.bio": bioFunc,
"author.email": emailFunc,
"author.website": websiteFunc,
"author.image": authorDotImageFunc,
"author.cover": coverFunc,
"author.location": locationFunc,
// Multiple block functions
"@first": atFirstFunc,
"@last": atLastFunc,
"@even": atEvenFunc,
"@odd": atOddFunc,
"name": nameFunc,
// Pagination functions
"prev": prevFunc,
"next": nextFunc,
"page": pageFunc,
"pages": pagesFunc,
"page_url": page_urlFunc,
"pageUrl": page_urlFunc,
// Possible if arguments
"posts": postsFunc,
"tags": tagsFunc,
"pagination.prev": prevFunc,
"pagination.next": nextFunc,
// Possible plural arguments
"pagination.total": paginationDotTotalFunc,
"../pagination.total": paginationDotTotalFunc,
}