destroytoday.com

Intro

I’ve been dying to make progress with the site as a whole, rather than only improving upon the blog portion, so I decided to take a simple first step by adding an “intro” to the top of the site. This is my first piece of content outside of the blog stream, which means I needed a new content model in Contentful. Since the content itself could be styled using the tags within the Rich Text editor, I created a Copy content model with only a body Rich Text field and an identifier slug field for referencing.

In my Nuxt view’s asyncData, I now needed to make two requests—one for the article entries and another for the intro. I searched around for to handle this, and found that instead of returning the Promise from the article entries request, I could make the method async, and await Promise.all([...]) with the two requests. Then, I simply return the data I need to use in my template.

Like the Article content model, I also made a Vue component for the Copy content model that renders the Rich Text field. Along with providing a reusable component, this gave me an opportunity to refactor my Article component, which also renders a Rich Text field. Instead of duplicating the code, I simply replaced the Article body with the Copy component.

Now that I took the first step outside the blog, I now have momentum to continue to other parts of the site. I’m not sure what I’ll tackle next, but it feels good to have the intro—even if the copy itself is still in flux.