Description
The Velocity dispatcher allows you to use the Velocity
template language in templates for your blog.
Installation and Configuration
In your /WEB-INF/classes/blojsom.xml file, add the following:
<bean id="vm" class="org.blojsom.dispatcher.velocity.VelocityDispatcher" init-method="init">
<property name="velocityProperties">
<ref bean="defaultVelocityProperties"/>
</property>
<property name="blojsomProperties">
<ref bean="defaultProperties"/>
</property>
<property name="servletConfig">
<ref bean="servletConfigFactoryBean"/>
</property>
</bean>
The defaultVelocityProperties bean is where Velocity properties are configured. You can find more information on configuring Velocity by looking at the Velocity developer guide
.
<bean id="defaultVelocityProperties" class="org.springframework.beans.factory.config.PropertiesFactoryBean">
<property name="properties">
<props>
<prop key="resource.loader">file, class</prop>
<prop key="file.resource.loader.description">Velocity File Resource Loader</prop>
<prop key="file.resource.loader.class">org.apache.velocity.runtime.resource.loader.FileResourceLoader</prop>
<prop key="file.resource.loader.cache">true</prop>
<prop key="file.resource.loader.modificationCheckInterval">60</prop>
<prop key="class.resource.loader.description">Velocity Classpath Resource Loader</prop>
<prop key="class.resource.loader.class">org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader</prop>
<prop key="class.resource.loader.cache">true</prop>
<prop key="class.resource.loader.modificationCheckInterval">0</prop>
<prop key="input.encoding">UTF-8</prop>
<prop key="output.encoding">UTF-8</prop>
<prop key="runtime.log.logsystem.class">org.apache.velocity.runtime.log.NullLogSystem</prop>
<prop key="velocimacro.library">org/blojsom/plugin/admin/templates/admin-macros.vm,org/blojsom/plugin/velocity/page-macros.vm,user-macros.vm</prop>
<prop key="velocimacro.permissions.allow.inline">true</prop>
<prop key="velocimacro.permissions.allow.inline.local.scope">true</prop>
</props>
</property>
</bean>
The defaultProperties bean should already be configured.
<bean id="defaultProperties" class="org.springframework.beans.factory.config.PropertiesFactoryBean">
<property name="properties">
<props>
<prop key="default-blog">default</prop>
<prop key="ignore-flavors">admin, rsd</prop>
<prop key="installed-locales">de, en, fr, jp, ko, pt_BR, sv, zh_CN</prop>
<prop key="resources-directory">/resources/</prop>
<prop key="templates-directory">/templates/</prop>
<prop key="themes-directory">/themes/</prop>
<prop key="blogs-directory">/blogs/</prop>
<prop key="bootstrap-directory">/bootstrap/</prop>
</props>
</property>
</bean>
Usage
You can find a reference for the Velocity template language
online.