feat: Adds more navigation items to sidebar and removes top navigation bar.
All checks were successful
CI / release (push) Successful in 6m53s
All checks were successful
CI / release (push) Successful in 6m53s
This commit is contained in:
@@ -56,6 +56,8 @@ extension Item where M == ArticleMetadata {
|
||||
|
||||
extension Array where Element == Item<ArticleMetadata> {
|
||||
|
||||
/// Iterate through the aritcles, getting all the years that articles
|
||||
/// have been written or updated.
|
||||
func years() -> Set<String> {
|
||||
let dateFormatter = DateFormatter()
|
||||
dateFormatter.dateFormat = "yyyy"
|
||||
@@ -68,6 +70,7 @@ extension Array where Element == Item<ArticleMetadata> {
|
||||
}
|
||||
}
|
||||
|
||||
/// Iterate through the articles and get the unique tags.
|
||||
func uniqueTags() -> Set<String> {
|
||||
reduce(into: Set()) { set, item in
|
||||
for tag in item.metadata.tags {
|
||||
@@ -75,6 +78,14 @@ extension Array where Element == Item<ArticleMetadata> {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Iterate through the articles and get the unique tags along with the count of
|
||||
/// how many times the tag is used.
|
||||
func uniqueTagsWithCount() -> [(String, Int)] {
|
||||
let tags = flatMap { $0.metadata.tags }
|
||||
let tagsWithCounts = tags.reduce(into: [:]) { $0[$1, default: 0] += 1 }
|
||||
return tagsWithCounts.sorted { $0.1 > $1.1 }
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE: Most of these are taken from https://github.com/loopwerk/loopwerk.io
|
||||
|
||||
Reference in New Issue
Block a user