This module is part of the Apache Sling project.
This sample is designed as an introduction to Sling and HTL.
java -jar org.apache.sling.launchpad-8.jar
mvn clean install -PautoInstallBundle
http://localhost:8080/content/htlblog.html
HTL Blog uses Sling Models extensively. You can read about them here.
Author.java
- This model detects if our user is logged in or not.Edit.java
- This is used to get a query parameter from our request, find the resource associated with the param, and adapt it to our post model.List.java
- This is used to iterate through our posts, reverse their order, and adapt them to our post model.Post.java
- This model injects our post properties, finds the featured image, and lists any children (comments).The content is built using a single JSON file called htlblog.json
. It maps to the following nodes:
/content/htlblog
- Our homepage. Currently lists our posts./content/htlblog/admin
- Our admin home. Used to list our posts for editing or deleting./content/htlblog/admin/edit
- Our edit page. Use to create, or if a post path is supplied, it will edit an existing post./content/htlblog/posts
- Another post list, but also used as the parent of our posts./content/htlblog/posts/hello-world
- Used to scaffold a placeholder post./content/htlblog/posts/hola-mundo
- Used to scaffold a 2nd placeholder post.