I completely rewrote my personal website using Dev.to as a CMS

Search for a command to run...

No comments yet. Be the first to comment.
Do you ever watch your view count rise and wonder which posts are being read the most? I know I did. That is one reason why I chose to develop my own Dev.to analytics dashboard to display historical data such as view, reaction and follower increase ...

Ever wondered if you can share interfaces, types and functions between TypeScript projects? I'm currently developing a project consisting of two separate TypeScript applications, one being a React.js dashboard and the other an Azure Function app writ...

My personal website is built on Next.js and uses both the getStaticProps and getStaticPaths functions to dynamically generate the /blog/ and /portfolio/ pages at build time. While updating both methods to use their proper TypeScript types, following ...

Usually, when adding icons to a website, I'll use React-icons. There are times, however, when I prefer to copy an exact SVG from a website. Downloading an SVG isn't as easy as downloading an image on a website. Fortunately, SVG Export extracted them ...

The final weekend of January 2021 was uneventful in comparison with other years - in the UK we were in full lockdown due to the Coronavirus. It was, however, the perfect opportunity to completely rewrite my personal website.
I decided to redesign and rewrite my website for several reasons:
Originally published at wallis.dev at the top of this article.
My old home page
My favourite part of my website is the use of Dev.to as a Content Management System for the blog and portfolio pages. I've seen the Dev.to API utilised before to display a user's articles on their website but, AFAIK, not quite in the same way as I've applied it.
The benefits of using Dev.to as a CMS are:
Before I continue I want to stress that I intend to use Dev.to purely for my blog and portfolio (past projects / showdev). I won't be using Dev.to to create pages which are not articles and would cause Dev.to to become cluttered with spam if others follow suit. For example, the about section on the home page is hardcoded into the website and if I created a page for my education history, I'd keep that purely for the website and wouldn't post it to Dev.to - I'd probably use Markdown for these.
Built using Next.js, the website uses two dynamic routing functions (getStaticPaths and getStaticProps) to generate the blog and portfolio pages.
Before an article is displayed on my website, it must meet the two following requirements:
https://wallis.dev/blog/... will be built as part of my blog whereas, if its canonical URL is https://wallis.dev/portfolio/... it will be a portfolio piece.For every article that meets the requirements, the subsequent build process is followed:
At build time, Next.js calls the getStaticPaths function which
/api/articles/me).slug will be the canonical URL path.For each page, Next.js calls getStaticProps which fetches the page's article from the cache. The article contains the name, description and HTML.
/api/articles/{id}) to fetch the page's article, so I could use the HTML rendered by Dev.to. However, this caused build failures as I was making too many API requests at once - so now I render the markdown using remark-html.name and description and then display the HTML I rendered earlier in getStaticPaths using remark-html. For styling, I use the Tailwind Typography plugin.To ensure that the website is always in sync with my articles on Dev.to, I use a Vercel Deploy hook which is triggered each time I create or update an article using a Dev.to webhook. I use a Deploy Hook rather than Incremental Static Regeneration so that the blog is only rebuilt when something has changed rather than at random intervals.
Note: I use Dev.to APIs that require authorisation as they seem to have a higher request limit compared to the public routes. When using public APIs and fetching each article via the article API, I found that my builds were failing with a 429 error which is Dev.to rate-limiting requests. - I probably could switch to using public APIs now that I'm using a cache to read the articles from.
I'm currently writing a detailed article which describes in greater detail how my website utilises Dev.to as a CMS, stay tuned (and follow on Dev.to to be notified when I release it)!
Navigating through wallis.dev
highlight.js and remark-highlight.js.In this article, I discussed rewriting my personal website from the ground up using Dev.to as a Content Management System for the blog and portfolio pages.
Like the idea of using Dev.to as a CMS for your blog? React! Found something I could improve or that you would have done differently? Let me know in the comments.
Thanks for reading!
By the way, you can view this article live on my website here.