Vinay Vishal | 7c4c4fc | 2019-01-28 12:01:04 +0530 | [diff] [blame] | 1 | # A JBake project template |
| 2 | |
| 3 | ## About JBake |
| 4 | |
| 5 | JBake is a static site generator, it's inspired from jekyll and written |
| 6 | in java. The basic idea is to have templates for the structure of the |
| 7 | page, and the body generated from asciidoc content. |
| 8 | |
| 9 | ## Pre requisites |
| 10 | |
| 11 | - Maven |
| 12 | - JDK8+ |
| 13 | |
| 14 | Deploying to Github will require password less authentication. |
| 15 | |
| 16 | This is done by exporting your SSH public key into your Github account. |
| 17 | |
| 18 | ## Build the site locally |
| 19 | |
| 20 | The site is generated under target/staging. |
| 21 | |
| 22 | Open file:///PATH_TO_PROJECT_DIR/target/staging in a browser to view the site. |
| 23 | |
| 24 | ``` |
| 25 | mvn generate-resources |
| 26 | ``` |
| 27 | |
| 28 | Or you can invoke the JBake plugin directly. |
| 29 | |
| 30 | ``` |
| 31 | mvn jbake:build |
| 32 | ``` |
| 33 | |
| 34 | ### Rebuild the site on changes |
| 35 | |
| 36 | ``` |
| 37 | mvn jbake:watch |
| 38 | ``` |
| 39 | |
| 40 | If you keep this command running, changes to the sources will be |
| 41 | detected and the site will be rendered incrementally. |
| 42 | |
| 43 | This is convenient when writing content. |
| 44 | |
| 45 | ### Serve the site locally |
| 46 | |
| 47 | ``` |
| 48 | mvn jbake:serve |
| 49 | ``` |
| 50 | |
| 51 | If a webserver is required (e.g. absolute path are used), this command |
| 52 | will start a webserver (jetty) at http://localhost:8820. It will also |
| 53 | watch for changes and rebuild incrementally. |
| 54 | |
| 55 | ## Deploy the site to Github Pages |
| 56 | |
| 57 | ``` |
| 58 | mvn deploy |
| 59 | ``` |
| 60 | |
| 61 | ## Produce a zip file for download |
| 62 | |
| 63 | To produce a zip file containing the generated html files, use: |
| 64 | |
| 65 | ``` |
| 66 | mvn package |
| 67 | ``` |
| 68 | |
| 69 | When making a release on GitHub, this zip file should be added to the release. |
| 70 | |
| 71 | ## Links |
| 72 | |
| 73 | - [JBake maven plugin documentation](https://github.com/Blazebit/jbake-maven-plugin) |
| 74 | - [JBake documentation](http://jbake.org/docs/2.5.1) |
| 75 | - [Freemarker documentation](http://freemarker.org/docs) |
| 76 | - [AsciiDoc User Guide](http://asciidoc.org/userguide.html) |
| 77 | - [Asciidoctor quick reference](http://asciidoctor.org/docs/asciidoc-syntax-quick-reference) |