Cross-Site Includes
From the desk of pieterh
Via the hotlinked-heaven department, on 1256998777|%e %B %Y, %H:%M
On Thursday and Friday we rolled out a very important new feature, cross-site includes, or CSIs. CSIs make it possible to share code across sites. I'll explain roughly how this works, and provide some examples of where we're already using it.
First, to see it working: take any one of your sites, which has a category with pages (e.g. 'mycat'), and create a category _start page that contains just this: [[include :modules:include:8 page=mycat:_start | category=mycat | label=Mystuff]] This pulls in the Hammer Navigator, which shows a list of the pages in that category. Hammer is the pattern that organizes wiki pages as a list.
CSIs work just like normal includes except that you add ':sitename:' in front of the page name. In this example, :modules: refers to http://modules.wikidot.com, a new site we started a few days ago to hold collections of CSIs, which we're calling 'userspace modules' (as compared to the modules Wikidot provides us).
Here is another example, the wishlist module. This lets you add a simple wish list to other pages, e.g. to documentation pages. To install, create wish:_template containing [[include :modules:include:11]] and then in your site manager, mark the wish category as autonumbered. Put this code into your primary page template where you want the wishlist to appear: [[include :modules:include:10]].
CSIs can happily act as live templates, accepting symbols from the calling page. This is how the first example I showed above works. The CSI code has things like this:
[[span style="border: 1px solid silver; font-weight:bold; padding: 7px"]][/{$category}:new-{$category}/edit/true/parentPage/{$page}/title/%20 Create a new {$label}][[/span]]
Which is a neat way of creating child pages in autonumbered categories, but that's another story.
You can see the modules I've already assembled at http://modules.wikidot.com. Feel free to try these. They are all being used, already, on this site, on the Iron Giant templates, and elsewhere.
CSIs make it very easy to pull code into your site and then never worry about maintaining it. The only downside is that you can't customize the code except by forking it and creating your own versions. When the author releases a new version of the CSI, your sites will immediately get the new version. If you want to discuss and improve an existing userspace module, head over to the projects forum.
To end with, we've made a Navigator tool (still beta, but already useful). Here's how to get the beta Navigator tool in your site in 30 seconds. First, edit the top menu to add:
* [/system:navigator Manage pages]
And then create system:navigator with this one line of code: [[include :modules:include:12 page=system:navigator]].
Update: to use the Navigator you do need a compatible stylesheet. If you're not using a Rainbow or Minimalist theme, please see the instructions on the Navigator page.






Wow… Wikidot has come so far. This is going to be a tremendous help and reduce all the manual duplication of code on my sites.
This is so great!! I'm so excited!!! I can't wait to use the CSI!
"But sanctify the Lord God in your hearts, and always be ready to give a defense to everyone who asks you a reason for the hope that is in you, with meekness and fear;" ~ 1 Peter 3:16
Thanks, I have been looking forward to cross site includes for a while now.
I think it is a very important and useful addition to the Wikidot module suite.
Wayne Eddy
Bundaberg, Australia
As much as I was looking forward to this I didn't think of the negatives till now so I have to ask;
Does this mean someone can do includes from other sites without a site owners permission? Will it expose pages from private sites?
Nope, it does not expose pages from private sites, as far as I can tell. (It actually gives a 500 error, which is not perfect, and which we'll fix.)
The Wikidot Blog | My other works
The new improvements are so great that make one think: are we close to anything like cross-site backlinks? and listpages (like, selecting everything with the same tag in two different sites)? Just dreaming — but I've learned that the Wikidot fairy grants wishes when one least expects…
Thanks, guys, for the amazing job!
I think the better option is to just have one site for everything that is related in some way.
With private categories in a public site [ not yet implemented :( ] a single site will meet all of your needs.
— Shane | Blog | CycloDS Revolution | Compatibility List | Want me to manage your next wiki? | XBL: leiger40
Automatic code replacement — Rate it up!
Next stop: Miami and New York.
this is a forum signature. really.
Thanks for this! I'm liking the Page Manager, but it doesn't show up cleanly on my site: all the stuff found in popup windows here http://modules.wikidot.com/include:12 is listed explicitly on the page, making for weird spacing.
It's a CSS issue. You'll want to add this to your custom theme's CSS (I think this catches all the items you need). We're going to have to work on adding CSI instructions for the pieces of CSS needed for some of the userspace modules. This might require breaking up our CSS into several pieces to handle situations just like this. Let us know if this works for you. Using Webdeveloper on your site and adding this to the CSS seems to work fine, but you may want to tweak the colors in the .layout elements to match your site better.
-Ed
Free Wikidot Applications · Your Shared Photo Gallery · Your Personal Blog
Thanks, Ed. That works very well. I haven't used CSS before, but that was simple enough. I tried it out with Web Developer and then added it to a custom theme. I couldn't figure out how to change the color of the sorting texts in the header (Title, Author, etc.), but it's fine as is.
Beyond CSS instructions, it would be great if these includes were somehow configurable. For example, I might not want to choose the items in Page Manager's popup menus or stay with an older version of the CSI-ed page when the author updates it. This could be done by letting each CSI page have several versions on modules.wikidot.com: the mainline version and custom versions that one can choose via the data forms module (once it exists)…?
EDIT: Thanks, Rob. That's just what I was looking for.
You could add another line to your CSS (at the bottom) as follows to set the author etc to white:
Ed, thanks for the answer. I've added better instructions to the module pages. Eventually we'll be able to move all necessary CSS into the module itself.
The Wikidot Blog | My other works
I tried including from a private site. I expected it to work… but it didn't.
Every time I attempted to save a page that was including from a private site, I got this message:
Every time I attempted to save a page that was including from an open or closed site, it worked perfectly fine.
And something really strange… I changed my private site to closed, added the include (which worked), then changed the site back to private. However, after logging out, clearing cache and refreshing several times, the content still appeared there. What is up with that? :S
This would be really useful. For example, adding this to a private site:
Then including that in a public site… should theoretically only show the menu to those that are also members of the private site. For example, a private site that only admins are a member of.
This could go further… by only showing a comments module on a page if it's an admin looking at the page (e.g. private admin discussion)
It could also lead to showing something completely different based on who visits the page. If you have two groups of users, both a member of WikiA, but split between WikiB and WikiC, then you could do this:
And the two groups of users would see different things (whilst anonymous users would see neither)
Any chance of getting this working? ;-)
— Shane | Blog | CycloDS Revolution | Compatibility List | Want me to manage your next wiki? | XBL: leiger40
Automatic code replacement — Rate it up!
I can confirm this behaviour… it does not work on private sites too - to include private site pages on to private site pages…
And I had of course problems with the included pages ( second level ) on this included pages from public sites ( handbook) .
CSI needs a specific design without self including other pages from it's own site with CSI …
This needs a re-structural work
Service is my success. My webtips:www.blender.org, www.zusi.de (Demo-Video)
Wollen Sie Wikidot helfen im deutschen » Handbuch ?
Possibly. It would mean holding many versions of a page, since there are unlimited combinations (member of sites A and B but not C) in theory, though probably not in practice.
This is similar to the discussion of conditional blocks and hits the same challenges of caching.
I'll discuss it with Michal but IMO this is the wrong way of getting conditional content. I'd be happy that CSIs only work from public sites (if you make them private afterwards, it'll only take effect when you recompile the calling page), and fix the error message so it's clear.
The Wikidot Blog | My other works