feat: Initial search implementation using pagefind.
This commit is contained in:
@@ -63,16 +63,16 @@ func renderYear<T>(context: PartitionedRenderingContext<T, ArticleMetadata>) ->
|
||||
baseRenderArticles(context.items, canocicalURL: "/articles/\(context.key)/", title: "Articles in \(context.key)")
|
||||
}
|
||||
|
||||
private struct SearchData: Encodable, Identifiable {
|
||||
let id: String
|
||||
private struct SearchData: Encodable {
|
||||
let url: String
|
||||
let title: String
|
||||
let content: String
|
||||
let body: String
|
||||
|
||||
init(article: Item<ArticleMetadata>) throws {
|
||||
self.id = article.url
|
||||
self.url = article.url
|
||||
self.title = article.title
|
||||
let rawContent: String = try article.absoluteSource.read()
|
||||
self.content = Self.parse(rawContent)
|
||||
self.body = Self.parse(rawContent)
|
||||
}
|
||||
|
||||
/// Grabs the metadata (wrapped within `---`), the first title, and the body of the document.
|
||||
|
||||
Reference in New Issue
Block a user