This walkthough covers the bare essentials from creating a JBake site hosted in
either Amazon S3 or Github Pages,
using Cloud9 as your Development Enviroment
You need:
Currently,
Open a new shell session. Install mvm:
$ curl https://raw.github.com/ingenieux/mvm/master/install.sh | sh
$ source ~/.mvm/mvm.sh
$ mvm install 3.1.1
$ mvm alias default 3.1.1
Once finished, restart the shell session (type exit - it will respawn a new one)
Import the sources (replace the Git URL below):
$ git init
$ git add origin ssh://git@github.com/ingenieux/jbake-sample.git
$ git pull origin master
On Cloud9, you need to bind the port and the host. Use this command:
$ mvn jbake:inline -Djbake.port=$PORT -Djbake.listenAddress=$IP
That done, you could access it as http://
There are 4 goals:
* jbake:generate: Simply runs jbake
* jbake:watch: polls a folder and run jbake whenever changes happen
* jbake:inline: Same as watch, but also launches an embedded winstone container
For more details, run:
$ mvn jbake:help -Ddetail # -DgoalName=[watch|generate|inline]
The defaults use Amazon S3. In order to enable publishing, create a Server Settings with the the AWS Access Key Id as username and the Secret Access Key as a password.
Start by creating your settings.xml as shown in Configuring your AWS Credentials. Long story short:
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
http://maven.apache.org/xsd/settings-1.0.0.xsd">
<servers>
<server>
<id>yours3site</id>
<username>022QF06E7MXBSH9DHM02</username>
<password>{2A16DoTRdiUHn7djDvmu4O1E1JrYg5avldQ3Khv8B4jk4MzLpzJeSrabGG8aBSSfa3b2PAvfLvVCwsl0MaRmmA==}</password>
</server>
</servers>
</settings>
Then, change the pom.xml with it (see elements '
<configuration>
<fromDir>${project.build.directory}/${project.build.finalName}</fromDir>
<includes>**/*</includes>
<excludes>**/*.jsp,**/web.xml</excludes>
<url>s3://docs.ingenieux.com.br</url>
<serverId>docs.ingenieux.com.br</serverId>
</configuration>
Of course, you need your extra S3 setup in place, which means:
To publish, simply use this command:
$ mvn verify
Github offers a maven plugin. So we only need to enable it by adding that to your settings.xml as shown in their docs. Example:
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
http://maven.apache.org/xsd/settings-1.0.0.xsd">
<servers>
<server>
<id>github</id>
<username>aldrinleal</username>
<password>password</password>
</server>
</servers>
</settings>
In your pom.xml, remove the wagon plugin definition and use this instead:
<plugin>
<groupId>com.github.github</groupId>
<artifactId>site-maven-plugin</artifactId>
<version>0.9</version>
<configuration>
<message>Creating site for ${project.version}</message>
<outputDirectory>${project.build.directory}/${project.build.finalName}</outputDirectory>
<repositoryName>jbake-sample</repositoryName>
<repositoryOwner>ingenieux</repositoryOwner>
<excludes>
<exclude>**/*.jsp</exclude>
<exclude>**/web.xml</exclude>
</excludes>
</configuration>
<executions>
<execution>
<goals>
<goal>site</goal>
</goals>
<phase>verify</phase>
</execution>
</executions>
</plugin>
Add this as well:
<properties>
<github.global.server>github</github.global.server>
</properties>
We use syntaxhighlighter which covers most of the needs. See those two lines in header.ftl:
<link rel="stylesheet" href="http://yandex.st/highlightjs/7.3/styles/default.min.css">
<script src="http://yandex.st/highlightjs/7.3/highlight.min.js"></script>
On footer.ftl, we activate it:
<script type="text/javascript">
$(function() {
hljs.tabReplace = ' '; //4 spaces
hljs.initHighlighting();
});
</script>
Disqus is set in header.ftl:
<#if (content)?? && (content.disqus)??>
<!-- disqus stuff -->
<script type="text/javascript">
/* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
var disqus_shortname = 'ingenieux-docs'; // required: replace example with your forum shortname
/* * * DON'T EDIT BELOW THIS LINE * * */
(function() {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
</script>
<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
<a href="http://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>
<!-- /disqus stuff -->
</#if>
In order to allow disqus com a single page, make sure you enable disqus=true. Example (skel.md):
title=title
date=2013-10-11
type=page
status=published
disqus=true
~~~~~~
Tweak feed.ftl and custom.properties files
Simply add the qa script (or change the supplied one with the Tracking ID) on footer.ftl:
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-32618923-2', 'ingenieux.com.br');
ga('send', 'pageview');
</script>