I wonder if it is possible to check if a page has a specific parent in Velocity .vmd files?
I can't find anything about it.
edited
I am not sure I understand the terminology you are using. Please let me know if I am off on the wrong track.
The parent/child relationships between pages are recorded in the Confluence database in the confancestors table. You can get the pageIds for the child pages with a query like:
select descendentid from confancestors where ancestorid = '65585';
That will reveal the page ID's of all the child pages of the page with ID 65585. You can get that PageId by going to the ancestor page in the UI and choosing Page Information from the ... menu at the top right. Then you can check the page ID of the child page and see if it appears in the results from the query.
For example, my output was:
So there are three child pages of 65585, one of which is pageId 1605633
I hope this helps you reach your objective. Please let us know more about your requirements so we can provide more informed help.
Thanks,
Ann
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I just want to achieve that:
I display an icon in front of the page title, depending on the parent of that page.
So I have for example a page called "Installation" with 4 child-pages. All that 5 pages should have the "install-icon" in front of their page title.
And now I have another page, called "Procedures" with 3 child-pages. All that 4 pages should now have the "procedures-icon" in front of their page title.
I could get the URL by JavaScript, split it and check for the titles, depending on that titles, the pages get their icon. I do that now. But it's not nice, not flexible. Maybe there will be added another child page in the future... It should know it automatically.
Theoretically totally easy.
I found stuff to create a macro which gets the parent page (and that is the big problem), and depending on the parent, it just put an image in front of the title by JavaScript (that part already works).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ok, that works...
I saw something like that (a user macro):
## @noparams
<b>Title of the parent page:</b> $content.getParent().getTitle()
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Okay, that macro stuff works...
But I only get the parent of the above layer. But I want the very first parent.
So if the page tree looks like:
page1
-subpage1-1
-subpage1-2
-subpage1-2-1
-subpage1-2-1-1
-subpage1-2-1-2
-subpage1-2-2
-subpage1-3
page2
-subpage2-1
-subpage2-1-1
-subpage2-1-1-1
-subpage2-1-1-2
-subpage2-1-2
-subpage2-2
And now all subpages of page1 should give me the parent "page1" and all subpages of page2 should give me "page2".
But it's like:
If I take "subpage1-2-1" it gives me the direkt parent "subpage1-2" and not "page1".
Any ideas how to accomplish that?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.