It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Integrating Confluence in to our website

Hi

We're looking at using Confluence for an internal and external knowledgebase. A number of our suppliers use it, so we're happy it does what we want.

However we want our customers to find common wiki entries via our website, where we send them for various bits of info at the moment.

Other KB/Wiki tools we've looked at provide a javascript widget we can include in the site which will give us a CSS'able search box and results. That works nicely.

At a push I'd take the ability to use an iframe on our site pointing to a basic page with no confluence navbars or headers (just the page and search bar).

Anyone got any comments or feedback at all on this? Our site is in Wordpress if that helps.

Olly

3 answers

Olly,

I had previouly filed a similar feature request. Please take a moment to see if that will work for your needs. Please feel free to add any comments about functionality you see that is missing from the request.

https://jira.atlassian.com/browse/CONF-26832

I also wanted to direct your attention to our end user agreement.

http://www.atlassian.com/end-user-agreement/

It states that at mimimum your confluence instnace must contain the text "Powered By Atlassian" in the footer of your page. Please be sure to keep this in mind when you are developing this custom solution.

So, as they are saying no it's an iframe then? Is that right? Anyone know of a 3rd party widget which will allow searching from our site? Olly

Look at how the quick search drop down is populated in the Confluence search box - it delivers JSON to build the drop down menu.

Use a similar approach to query that same URL for your Wordpress search integration. You can use Firebug or Google Chrome developer tools to watch the network requests.

This approach means that you're just querying the available APIs - you won't have to add the "Powered by..." text.

Update:

This scrappy bit of working PHP code will add Confluence search results to a PHP page:

<!DOCTYPE html>
<html>
<head>
	<title>Search</title>
</head>
<body>
	<h1>Search Atlassian's documentation</h1>
	<form>
		<input name="q" placeholder="Search Confluence...">
		<input type="submit">
	</form>
<?php if (isset($_GET['q'])) {
	
		$query = rawurlencode( $_GET['q']);
		$timestamp = time();
		$baseUrl = 'http://confluence.atlassian.com';
		$url = $baseUrl.'/json/contentnamesearch.action?query='.$query.'&_='.$timestamp;
		$response = file_get_contents($url);
		$response = json_decode($response);
		
		$results = $response->contentNameMatches[0];
?>		
	<h2>Results</h2>
	<div>Searching: <?php echo $url; ?>	
	<h3>Formatted</h3>
	<ol>
	<?php foreach($results as $item) {?>	
		<li><strong><a href="<?= $baseUrl. $item->href ?>"><?= $item->name ?></a></strong> in <a href="<?= $baseUrl.'/display/'.$item->spaceKey ?>"><?= $item->spaceName ?></a></li>
	<?php } ?>
	</ol>

	<h3>Raw JSON</h3>
	<pre>
		<?php print_r($response); ?>
	</pre>
<?php } ?>
</body>
</html>

Clean it up with some error handling though. Also, take a look at the source code of contentnamesearch.action to get it to return more than 6 results ;)

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Posted in Confluence

Lessons and Learnings: Six Months of Working Remote [Discussion]

Hey there, folks! For most of us, the past six months- yes, you read that right- have been a journey. More people than ever before have pivoted to working remotely, and navigating being on-scre...

8,411 views 6 6
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you