DEV Community

Cover image for How to add a blog using Dev.to as a CMS to a Next.js website

How to add a blog using Dev.to as a CMS to a Next.js website

James Wallis on March 10, 2021

For a shorter introduction (about half the length) check out "I completely rewrote my personal website using Dev.to as a CMS". Preface ...
Collapse
 
joshmedeski profile image
Josh Medeski

Great post James!

Have you thought of migrating to the Next.js Incremental Static Regeneration (ISR) feature? You can reduce the amount of times you have to rebuild the whole site but just allowing each page to regenerate it's static state on the revalidation time you set.

Docs for ISR:
vercel.com/docs/concepts/next.js/i...

Collapse
 
jameswallis profile image
James Wallis

Hi Josh, thanks!
Yes in hindsight it would've been a lot easier to use ISR!
I originally decided that I wouldn't use it because that first user that hits it will not see the latest post - in reality, that user is going to be me aha. In any case it was fun to mess around with Vercel's deploy hooks.

Collapse
 
siddharthroy profile image
Siddharth Roy • Edited

The webhook api is no longer working

Collapse
 
jameswallis profile image
James Wallis

Aha great! Thanks for bringing this to my attention.

If you see this comment and are using the Dev.to API with Next.js then Incremental Static Regeneration is the way forward. I'll have to migrate my own site to this in the future!

Side note: I'm guessing the PR to remove webhooks was this one: github.com/forem/forem/pull/15827

Collapse
 
zakhargz profile image
Zak Hargreaves

Hey! This is a great article! I've been trying to achieve the same thing - On the last part, I'd love to see another tutorial series on building a dev.to powered blog from scratch. If this is something you're looking into, and not yet started, would you like to collaborate?

Collapse
 
jameswallis profile image
James Wallis

Hi Zak, thanks! I have an almost finished tutorial that has been saved in my drafts for weeks. I just need to find some time to finish it and split it into separate articles (as it's a bit long). I'd love to collaborate but I can't suggest anything other than proofreading and suggesting changes/additions - which would be appreciated but are not very exciting. I can share the draft and repo with you if you DM me?

Collapse
 
zakhargz profile image
Zak Hargreaves • Edited

Hey James - That sounds ace, I don't seem to have the ability to DM you from here, but I have followed you on Twitter, I'll message you on there.

Catch you soon.

Thread Thread
 
jameswallis profile image
James Wallis

Sounds good!

Collapse
 
jastuccio profile image
jastuccio

Thanks James! I went to look at your code. One of your "view on github" links is broken: https://github.com/james-wallis/wallis.dev/blob/master/pages/blog/%5Bslug%5D.ts

It seems the link should point to a tsx file instead of ts

works for me:
github.com/james-wallis/wallis.dev...

Collapse
 
jameswallis profile image
James Wallis

Great spot, I’ve fixed it! Thanks

Collapse
 
edo78 profile image
Federico "Edo" Granata

I'm thinking about the opposite ... using my website as the only source and have dev.to get the post from there. I'd prefere to own my contents

Collapse
 
jameswallis profile image
James Wallis

Yeah, I understand your viewpoint 100%.

Using Dev.to for me is more about being able to take advantage of their tools (editor, publishing workflow, webhooks to redeploy site) without having to configure external tooling such as a CMS. I'll be building a backup system just in case Dev.to decides to close down their servers!

Also, you own the rights to anything you post on Dev.to

Yes, you own the rights to the content you create and post on dev.to and you have the full authority to post, edit, and remove your content as you see fit.

They also add that they have the right to store, display, reformat and distribute it.

Collapse
 
edo78 profile image
Federico "Edo" Granata

I understand your point too. I was just intrigued by a diametrically opposite approach

Thread Thread
 
jameswallis profile image
James Wallis

For sure, it will be interesting to see what direction you take

Thread Thread
 
edo78 profile image
Federico "Edo" Granata

I haven't officialy started yet but I'm planning to use eleventy for my site and create an rss feed to use with the "Publishing to DEV Community from RSS" feature of dev.to to import my post

Thread Thread
 
jameswallis profile image
James Wallis

Nice, I've seen lots of Eleventy but I haven't actually looked into it yet.
My hesitation with using an RSS feed to import my posts is that I don't think they get updated if you make any changes on your website.

Collapse
 
juliang profile image
Info Comment hidden by post author - thread only accessible via permalink
Julian Garamendy

Nice! I did the pretty much same but without the need to rebuild on every change.
I'm using incremental static regeneration instead.

dev.to/juliang/using-dev-to-as-cms...

Collapse
 
aadityasiva profile image
Aadityasiva

This is awesome!!!

Collapse
 
jameswallis profile image
James Wallis

Thank you!

Some comments have been hidden by the post's author - find out more