The org.zkoss.zk.ui.sys.SEORenderer interface
Listener:
org.zkoss.zk.ui.sys.SEORenderer
A listener could implement SEORenderer to generate application-specific SEO content. The SEO content could be anything. It is visible to the search engine (for indexing), but it is not visible to the end users[1]
Notice that the class must implement SEORenderer. SEORenderer.render(Page, Writer) will be invoked each time the main page of a desktop has been rendered and sent to the client[2].
For example, assume you have an implementation called foo.MySEORenderer
, then
<!-- in WEB-INF/zk.xml -->
<preference>
<name>org.zkoss.zk.ui.sys.SEORenderer.class</name>
<value>foo.MySEORenderer</value>
</preference>
You could generate anything that you'd like the search engine to index in SEORenderer.render(Page, Writer):
package foo;
import org.zkoss.zk.ui.sys.SEORenderer;
import org.zkoss.zk.ui.Page;
public class MySEORenderer implements SEORenderer {
public void render(Page page, java.io.Writer out)
throws java.io.IOException {
out.write("<a href=\"whatever\">whatever</a>");
}
}
Notice that, if specified, this class will be instantiated and invoked even if the crawlable option is not enabled.
Real Example
You can also take a look at the ZK's blog about another approach to SEO in ZK Applications.
Version History
Version | Date | Content |
---|---|---|
5.0.7 | April 2011 | Renderer could be specified as a listener. |