Update collection title.

This commit is contained in:
2025-07-31 16:45:38 +08:00
parent a79c92f9e7
commit 2288926e31
2 changed files with 6 additions and 1 deletions

View File

@@ -51,6 +51,11 @@ export default function CollectionPage() {
}); });
}, [id]); }, [id]);
useEffect(() => {
if (!collection) return;
document.title = collection.title;
}, [collection])
const toBeDeletedRID = useRef<number | null>(null); const toBeDeletedRID = useRef<number | null>(null);
const handleDeleteResource = (resourceId: number) => { const handleDeleteResource = (resourceId: number) => {

View File

@@ -139,7 +139,7 @@ func serveIndexHtml(c fiber.Ctx) error {
if err == nil { if err == nil {
coll, err := service.GetCollectionByID(uint(collectionID)) coll, err := service.GetCollectionByID(uint(collectionID))
if err == nil { if err == nil {
title = "Collection: " + coll.Title title = coll.Title
description = utils.ArticleToDescription(coll.Article, 256) description = utils.ArticleToDescription(coll.Article, 256)
if len(coll.Images) > 0 { if len(coll.Images) > 0 {
preview = fmt.Sprintf("%s/api/image/%d", serverBaseURL, coll.Images[0].ID) preview = fmt.Sprintf("%s/api/image/%d", serverBaseURL, coll.Images[0].ID)