Add recemment modifié page accueil
This commit is contained in:
@ -710,6 +710,30 @@ func (i *Indexer) GetBacklinks(path string) []string {
|
||||
return result
|
||||
}
|
||||
|
||||
// GetRecentDocuments retourne les N documents les plus récemment modifiés
|
||||
func (i *Indexer) GetRecentDocuments(limit int) []*Document {
|
||||
i.mu.RLock()
|
||||
defer i.mu.RUnlock()
|
||||
|
||||
// Copier tous les documents dans un slice
|
||||
docs := make([]*Document, 0, len(i.docs))
|
||||
for _, doc := range i.docs {
|
||||
docs = append(docs, doc)
|
||||
}
|
||||
|
||||
// Trier par date de dernière modification (décroissant)
|
||||
sort.Slice(docs, func(i, j int) bool {
|
||||
return docs[i].LastModified > docs[j].LastModified
|
||||
})
|
||||
|
||||
// Limiter le nombre de résultats
|
||||
if limit > 0 && len(docs) > limit {
|
||||
docs = docs[:limit]
|
||||
}
|
||||
|
||||
return docs
|
||||
}
|
||||
|
||||
// extractInternalLinks extrait tous les liens internes d'un texte Markdown/HTML
|
||||
// Format: <a ... hx-get="/api/notes/path/to/note.md" ...>
|
||||
func extractInternalLinks(body string) []string {
|
||||
|
||||
Reference in New Issue
Block a user