-
-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathindex.cshtml
71 lines (61 loc) · 1.67 KB
/
index.cshtml
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
@using manager = System.Configuration.ConfigurationManager;
@{
// Make sure all URLs end with a slash
if (!Request.QueryString["path"].EndsWith("/"))
{
Response.RedirectPermanent(Request.QueryString["path"] + "/", true);
}
MarkdownPage page = PageSystem.GetCurrentPage(Request);
Page.Title = page.Parent == null ? manager.AppSettings["name"] : page.Title + " - " + manager.AppSettings["name"];
Page.Description = page.Description;
Page.Keywords = page.Keywords;
Page.Theme = manager.AppSettings["theme"];
Page.ShowHero = page.Parent == null;
MarkdownPage next = null;
MarkdownPage prev = null;
if (page.Parent == null)
{
next = page.Children.FirstOrDefault();
prev = null;
}
else
{
int index = page.Parent.Children.IndexOf(page);
next = index < (page.Parent.Children.Count - 1) ? page.Parent.Children[index + 1] : null;
prev = index > 0 ? page.Parent.Children[index - 1] : null;
}
if (Request.Headers["X-Content-Only"] == "1")
{
if (page.Parent != null)
{
@Helpers.RenderBreadcrumb(PageSystem.GetCurrentPage(Request))
}
Response.Headers.Add("X-Title", Page.Title);
if (next != null)
{
Response.Headers.Add("X-Next", Helpers.CreateLink(next));
}
if (prev != null)
{
Response.Headers.Add("X-Prev", Helpers.CreateLink(prev));
}
}
else
{
Layout = "~/themes/" + Page.Theme + "/_layout.cshtml";
}
WebPageHttpHandler.DisableWebPagesResponseHeader = true;
PageSystem.SetCacheHeaders(Context);
}
@section flipahead
{
@if (next != null)
{
<link rel="next" href="@Helpers.CreateLink(next)" />
}
@if (prev != null)
{
<link rel="prev" href="@Helpers.CreateLink(prev)" />
}
}
@RenderPage("themes/" + Page.Theme + "/page.cshtml", page)