Show Incoming Page Links

    Tag page
    Viewing 5 of 5 comments: view all
    @SteveB i tried your "backlink" script and put it into a template but it generates links with double // frontslashes. looks like xml.text(link, "path")), xml.text(link, "title") are doubling them. how to avoid that behaviour?
    Posted 05:07, 11 Nov 2009
    @SteveB Sorry to bother you, but now it works. I don't know why, i only checked the code in my backlink-template and reloaded the page and now it works.
    Posted 05:14, 11 Nov 2009
    and again i was mistaken...in your exampe are also double //... web.link(site.uri & "index.php" & { title: xml.text(link, 'path') ?? "" }, xml.text(link, 'title')) from http://developer.mindtouch.com/index.php?title=DekiScript/FAQ/How_do_I..._List_the_most_popular_pages%3F works
    Posted 07:29, 11 Nov 2009
    I got it, tisso:

    // Set this path to the page you want the incoming links for, or page.path for the current page.
    var targetpath = $path;

    var targetpage = wiki.getpage(targetpath);
    var metadata = wiki.api(targetpage.api);
    <ul>
    foreach(var link in metadata["inbound/page"]) {
    <li> web.link(uri.build(site.uri, xml.text(link, "path")), link.title); </li>
    }
    </ul>
    Posted 15:19, 12 Jan 2010
    @DocDuck @tisso; I refactored the code a bit; it know avoids the wiki.getpage call, which is one less DB load and it also first collects the data into a list and then displays it; this makes it easier to reuse this example if you actually wanted to do some work with the data rather to display it immediately
    Posted 13:08, 13 Jan 2010
    Viewing 5 of 5 comments: view all
    You must login to post a comment.

    Copyright © 2011 MindTouch, Inc. Powered by