简体   繁体   中英

How to create the child page to parent page in wiki

I am posting a new query regarding wiki page creation programmatically using SBT.

I tried to create the wiki page under one parent page but did not find a link to map both parent and child. Every time I create the wiki page it gets created independently without community(non-community wiki page).

I working with a playground but it is throwing some exceptions.

Thanks in advance for your response.

There is no code specifically to set a child page. You'll have to extend the wiki service in the sbt to make it work for child pages.

Per http://bastide.org/2014/05/06/creating-a-new-wiki-page-as-a-child/

API Details URL: https://{hostname}:{port}/wikis/basic/api/wiki/{wiki-label}/feed Method: POST Content-Type: application/atom+xml

You may have to add the X-Update-Nonce header.

You have to update the XML with the parentUuid – eg bd586bb6-d9b2-4527-b9a0-0f9b0d3c1e3f

When you complete the post, you'll have a new page with a parent page.

<entry xmlns="http://www.w3.org/2005/Atom">
<category term="Test" label="Test"></category>
<category term="page" label="page" scheme="tag:ibm.com,2006:td/type"></category>
<parentUuid xmlns="urn:ibm.com/td">parentUuid</parentUuid>
<title>Tes4</title>
<summary></summary>
<label xmlns="urn:ibm.com/td">Tes4</label>
<content type="text/html"><?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html [<!ENTITY amp "&#38;#38;"><!ENTITY lt "&#60;#60;"><!ENTITY gt "&#62;#62;"><!ENTITY nbsp "&#160;"><!ENTITY apos "&#39;"><!ENTITY quot "&#34;">]><div></div></content></entry>

Hi Srinivas In SBT if you are using wikiservice.js, you just need to make sure you are using correct wiki label.

Here is the sample code for adding a page to wiki named manishkataria

var wikiPage = wikiService.newWikiPage(); 
wikiPage.setWikiLabel("manishkataria"); 
wikiPage.setTitle("dummytitle"); 
wikiPage.setSummary("dummysummary"); 
wikiPage.setTags("tag2"); 
wikiPage.setLabel("uniquelabel1"); 
wikiPage.setContent("dummy content");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM