forked from magento/devdocs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsite.rb
32 lines (25 loc) · 828 Bytes
/
site.rb
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
module Jekyll
# Extensions to the Jekyll Site class.
class Site
# Regular expression by which blog posts are recognized
GUIDE_PAGE_RE = /\/guides/
# Find my blog posts among all the pages.
def guides
self.pages.select {|p| p.full_url =~ GUIDE_PAGE_RE}
end
# Add some custom options to the site payload, accessible via the
# "site" variable within templates.
#
# articles - blog articles, in reverse chronological order
# max_recent - maximum number of recent articles to display
alias orig_site_payload site_payload
def site_payload
h = orig_site_payload
payload = h["site"]
payload["articles"] = guides
#payload["max_recent"] = payload.fetch("max_recent", 15)
h["site"] = payload
h
end
end
end