Adding static pages to an Eleventy blog

I'm a full-stack developer from South Africa 🇿🇦. I love writing about JavaScript, HTML and CSS.
Search for a command to run...

I'm a full-stack developer from South Africa 🇿🇦. I love writing about JavaScript, HTML and CSS.
Thanks Braydon 👍
This looks really great Chris Bongers. I have heard a lot about Eleventy and would love to try it out some day.
Thanks so far I'm loving Eleventy, done about 4 websites in it now, and it's a blast to work with.
If you ever have any questions, hit me up :)
Chris Bongers 4? Wow!
Oh yes, I will definitely reach out to you if I need help.
Most of you know me for my consistency, a golden arrow in my blog series. I've written 1000 articles in 1008 days! Almost an article a day, and my honeymoon was the only holiday I ever took. I'm super proud of this achievement; it has been a fantasti...

It's not the first time I'll be talking about community. I think it's an essential aspect of any successful tool. This shows in my previous explorations of Astro, Medusa, and now Vendure as well. All these products thrive in a super open, welcoming, ...

The cool part about Vendure is how easy it is to set up and how abstract each layer is. Basically, we get the following elements: External database Server Worker Admin UI Frontend While this is amazing, it also brings a bit of complexity when it co...

The previous article looked at customizing Vendure on a data and process level. In this article, we'll look at customizing emails, as they are often a big part of a webshop system. We'll be looking at two different layers of customization for customi...

Even though Vendure is a pretty significant project out of the box, in some cases, we might want to go in and modify some elements to work to our specific use case. In this article, I'll take a high-level look at some elements we can customize within...

So far, we have come quite a long way with our Eleventy lifestyle blog series today. We will be focussing on adding the static page, which is the about page.
Adding static pages is a more straightforward process since Eleventy will parse any site in your src directory ending in .md or .njk.
The about page we are building will look like this:

Let's create an about.njk file in the src directory.
I opt for a nunjucks (.njk) file since it allows us to do more styling with divs.
Inside the file, we can add the following as the header:
---
permalink: /about/
---
{% extends 'layouts/base.njk' %}
{% block content %}
<h1>About page</h1>
{% endblock %}
This will render the /about/ page as such.

As you can see, it's nothing like our end-goal. So let's get to it and add the markup we are going to need.
<main class="flex flex-col md:flex-row">
<div class="w-full p-4 py-24 md:w-1/2">
<!-- LEFT SIDE -->
</div>
<div class="sticky top-0 flex items-end w-full h-auto p-4 py-24 text-white md:h-screen md:w-1/2 bg-pattern-dots">
<!-- RIGHT SIDE -->
</div>
</main>
We start by using the <main> element to wrap everything in.
Inside we have two half-width columns. The left one is pretty plain. It only has some extra spacing.
The right one, however, is quite interesting. It used a sticky position and is made to fit the exact screen.
I then use the flex-end class to place the image at the bottom.
We also introduce a new background called bg-pattern-dots.
To add this new pattern, we must modify the tailwind.config.js file once more and add the following:
backgroundImage: {
"home-1": "url('images/home-intro.jpg')",
"pattern-striped": "url('images/pattern-striped.png')",
"pattern-dots": "url('images/pattern-dot.png')",
},
As for the left column, we use an <article> wrapper with another vertical spacing.
Inside we can put all our content.
<article class="mx-12">
<h1 class="mb-8 text-4xl font-bold">Why I am The Todoist</h1>
<p class="text-xl text-pink"><strong>Time for a change;</strong> It was in December 2017 I had a change in how I wanted to see life. I was just bored with getting home watching tv and not much more. Surely there must be more interesting stuff to do than this?</p>
<hr class="w-2/12 my-12" />
<p>The other content...</p>
</article>
The right column uses a similar approach for spacing, but it's using a <aside> element.
<aside class="mx-12">
<img src="/images/about.jpg" class="w-full shadow-xs">
</aside>
This will result in the following:

You can find today's code on GitHub.
Thank you for reading my blog. Feel free to subscribe to my email newsletter and connect on Facebook or Twitter