Last modified by Anton Bittner (Admin) on 24.11.2025

From version 1.1
edited by Carina Enke (Admin)
on 30.01.2024
Change comment: Install extension [org.xwiki.contrib.blog:application-blog-ui/9.13.6]
To version 2.1
edited by Anton Bittner (Admin)
on 24.11.2025
Change comment: Install extension [org.xwiki.contrib.blog:application-blog-ui/9.15.6]

Summary

Details

Page properties
Author
... ... @@ -1,1 +1,1 @@
1 -XWiki.carina_admin
1 +XWiki.anbit_admin
Syntax
... ... @@ -1,1 +1,1 @@
1 -XWiki 2.0
1 +XWiki 2.1
Content
... ... @@ -12,8 +12,24 @@
12 12  #macro(getTargetCategory $categoryDoc)
13 13   #set($category = "$!{request.category}")
14 14   #if($category == '')
15 - #if("$!doc.getObject($blogCategoryClassname)" != '' || $doc.getObject('XWiki.DocumentSheetBinding').sheet == 'Blog.CategoriesSheet')
16 - #set ($category = $doc.fullName)
15 + #set ($categoryDoc = $doc)
16 + ## Since 9.15, category data may exist in Blog or Blog.Categories. Code supports both paths to maintain backward compatibility.
17 + ## This code checks whether a category exists in its original location (e.g., Blog.News).
18 + ## If the category is not found, it assumes a migration has occurred and automatically sets the category to its new location in the Blog.Categories namespace (e.g., Blog.Categories.News).
19 + #if (!$services.blog.hasLegacyCategoryAssignments())
20 + #set ($oldCategoryRef = $categoryDoc.documentReference)
21 + ## When accessing "Blog/News?xpage=plain&sheet=Blog.CategoryRss" and the Blog.News document is missing, the current doc is Blog.News.WebHome and that needs to be translated into the migrated category Blog.Categories.News.
22 + #if ($oldCategoryRef.name == 'WebHome')
23 + #set ($oldCategoryRef = $categoryDoc.documentReference.parent)
24 + #end
25 + #set ($newCategoriesSpaceRef = $services.model.createSpaceReference('Categories', $oldCategoryRef.parent))
26 + #set ($newCategoryRef = $services.model.createDocumentReference($oldCategoryRef.name, $newCategoriesSpaceRef))
27 + #if ($xwiki.exists($newCategoryRef))
28 + #set ($categoryDoc = $xwiki.getDocument($newCategoryRef))
29 + #end
30 + #end
31 + #if("$!categoryDoc.getObject($blogCategoryClassname)" != '' || $categoryDoc.getObject('XWiki.DocumentSheetBinding').sheet == 'Blog.CategoriesSheet')
32 + #set ($category = $categoryDoc.fullName)
17 17   #else
18 18   #set($category = $defaultCategoryParent)
19 19   #end