-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_Links.cshtml
22 lines (22 loc) · 905 Bytes
/
_Links.cshtml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
@{
List<Tuple<string, string>> pages = Context
.Documents[Blog.Pages]
.Where(x => x.Bool(BlogKeys.ShowInNavbar, true))
.Where(x => x.FilePath(Keys.RelativeFilePath)?.FullPath?.StartsWith("index") == (bool?)false)
.Select(x => Tuple.Create(x.WithoutSettings.String(Keys.Title), Context.GetLink(x)))
.Where(x => !string.IsNullOrEmpty(x.Item1))
.OrderBy(x => x.Item1)
.ToList();
if(Documents[Blog.Tags].Any())
{
pages.Insert(0, Tuple.Create("Tags", Context.GetLink("tags/index.html")));
}
if(Documents[Blog.BlogPosts].Any() && Context.Bool(BlogKeys.GenerateArchive))
{
pages.Insert(0, Tuple.Create("Archive", Context.GetLink(Context.String(BlogKeys.PostsPath) + "/index.html")));
}
foreach(Tuple<string, string> page in pages)
{
<a class="page-link" href="@page.Item2">@page.Item1</a>
}
}