The plugin is available from Atlassian Plugin Repository. Alternatively grab the jar referenced above and install manually via Administration Console/Plugins.
The plugin has no external dependencies.
Usage
Once you have installed the extension you can apply it to the main decorator of any space that uses default Confluence theme or embed in your own theme decorators.
To enable EasySEO features insert the following code in your "main" decorator in the HTML head section. Remove any code associated with HTML title if present.
The format of the title is defined using the following "variables" in the 4th parameter to "renderTitle":
variable
value
{0}
space key
{1}
space name
{2}
space description
{3}
page/blog title
{4}
page/blog version comment
The list of keywords is assembled automatically from the labels on the page of blogpost. Labels with underscores are omitted.
The author is retrieved from creator of the content entity in question.
The description is generated automatically from {excerpt} macro or if not present from the page summary produced by the build-in Confluence summarizer if requested.
The date is the last modification date for the content entity (page, blog post) being displayed.
The last parameter in all calls is isXHTML flag - to produce valid "closed" XHTML tags.
There is also a 4 and 5 argument form for meta description renderer
## 4th parameter indicates if description is required or should only be produced if
## {excerpt} macro is present on the page
$seoHelper.renderMetaDescription($contentid, $username, false, true)
## 5th parameter indicates ifnew method to produce excerpts should be used if
## {excerpt} macro is NOT present on the page
$seoHelper.renderMetaDescription($contentid, $username, false, true, true)
All methods that have "contentid" as a parameter have counterparts that require the space key only and use the home page for this space as the content entity:
Additionally this plugin supplies macro {seo-link}
When linking to a Confluence page or blogpost this macro automatically uses excerpt as the HTML A title attribute. This macro supports all attributes of the HTML <A> tag. Please see macro help for all parameters.
{seo-link:Another page|id=seoLink|class=seoLinkClass|style=text-decoration:none}
link to another page{seo-link}
results in:
<a href="/display/TEST/Another+page"
title="This is the excerpt from the Another page..."
style="text-decoration:none"
class="seoLinkClass"
id="seoLink">
link to another page</a>
If you want to suppress title tags for links to pages that do not have the {excerpt} macro, use parameter "noautoexcerpt=1".
If you want to use the new method of summarizing the page when producing excerpts automatically for pages that do not have the {excerpt} macro, use parameter "useNewExcerptMethod=1".
In Velocity templates one can use the following call:
## The last 6 arguments correspond to HTML <A> tag attributes and can be set to null
## $href is only taken into account if $page is not specified
$seoHelper.renderSeoLink($body, $spacekey, $page, $sourcePageId,
$href, $title, $style, $id, $cssClass, $onclick)
## if the value for the title attribute is not set explicitly it is automatically built
## using the same methods as used fro the meta description value, but only if $page is specified
## if you want to suppress building of titles when {excerpt} is NOT present on the $page page
## specify "false" in the 11th argument
## if you want to use the new excerpt method use "true" in the 12th argument
$seoHelper.renderSeoLink($body, $spacekey, $page, $sourcePageId,
$href, $title, $style, $id, $cssClass, $onclick, true, true)