Build a Markdown-based Blog with Spring Boot — Part 5

Build a Markdown-based Blog with Spring Boot — Part 5

Recap

Right before this part, we have finished building how the blog works — we use Markdown files stored in resources/posts directory to populate our database and then fetch the posts on respective requests using our PostController class.

Bootstrap WebJar

For Bootstrap, we just need to add its WebJar in the pom.xml file.

Add Bootstrap WebJar in pom.xml

Header for our templates

Inside the resources/templates directory, create a new template: header.html. This will be the header portion of our blog that will be present in every page.

Create a header fragment

Creating a home page

Next, create a template, posts.html, that will serve as our home page.

Create a home page

The one where we render a post

Now onto our post.html template. This will be the page that renders a single blog post in full.

Create a page to render a blog post

Running the application

Run the Spring Boot application and wait until the JVM starts running.

Check the application
Check the application
Change pagination parameters
Change pagination parameters
Render full post
Render full post

Code

We have successfully built the blog application that we set out to build. In the following article, we will see how we can deploy our application to Heroku, host our database on RemoteMySQL, and use Heroku’s Automatic Deployment feature to update our blog whenever we add a new blog post.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store