forked from superfly/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathguides.html.erb
97 lines (90 loc) · 1.98 KB
/
guides.html.erb
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
93
94
95
96
97
---
title: Guides and Examples
layout: docs
toc: true
nav: firecracker
---
<% categories = HashWithIndifferentAccess.new(
guide: {
title: "Guides"
},
# performance: {
# title: "Application Performance",
# },
# "custom domains": {
# title: "Custom Domains for SaaS",
# },
# graphql: {
# title: "GraphQL"
# },
# app: {
# title: "Example Applications",
# },
elixir: {
title: "Elixir Guides",
},
# proxy: {
# title: "Proxies",
# },
# ci: {
# title: "Deployment Tools",
# },
# msg: {
# title: "Messaging"
# },
# apigw: {
# title: "API Gateways"
# },
# cdn: {
# title: "CDNs"
# },
# "6pn": {
# title: "6PN Private Networking"
# },
# volumes: {
# title: "Volumes"
# },
# certs: {
# title: "Certificates"
# }
).map { |k, v| [k, OpenStruct.new(v)] }
guides = sitemap.resources.select { |r| r.path =~ %r{^docs/app-guides/} }.map do |page|
OpenStruct.new(
{ url: page.url }.merge(page.data)
)
end
new_guides = guides
guides.select { |g| g[:author].present? }.each do |g|
g[:author] = data.authors[g[:author]]
end
new_guides = new_guides.sort_by(&:date).reverse.first(3)
idx = HashWithIndifferentAccess.new
guides.each do |p|
p&.categories&.each do |c|
idx[c] ||= []
idx[c].push(p)
end
end
%>
<section class="grid grid-cols-1 gap-3 font-medium">
<% categories.each do |k, v| %>
<dl id="<%= k %>" class="bg-gray-100 rounded-xl p-8 text-base text-navy target:bg-violet-100">
<dt
id="h-<%= k %>"
class="font-heading text-xl mb-5"
>
<%= v.title %>
</dt>
<dd>
<ul>
<% idx[k].sort_by(&:title).each do |p| %>
<% author = p.author %>
<li>
<a href="<%= p.url %>"><%= p.title %></a>
</li>
<% end %>
</ul>
</dd>
</dl>
<% end %>
</section>