DEV Community

Cover image for Start your blog with a Dev.to backend

Start your blog with a Dev.to backend

Patrick Hanford on November 11, 2019

Thanks to Dev.to, us developers have a niche platform to write without the need to start our own blog. This is awesome, but you built a portfolio s...
Collapse
 
evanplaice profile image
Evan Plaice

For syntax highlighting you could feed the raw markdown into the wc-markdown web component.

github.com/vanillawc/wc-markdown

It has markdown parsing (Marked) and syntax highlighting (PrismJS) built-in.

I'm going to try hosting this from a S3 Bucket.

Collapse
 
codespent profile image
Patrick Hanford

This is huge. Thank you! May just be the solution to some styling hacks here as well. :)

Collapse
 
evanplaice profile image
Evan Plaice

In theory, it should work. I haven't actually tried integraring the web component into Vue yet. When you import, use the dist/ bundle.

I've been looking for a setup like this for my own blog. So, I'll be trying to do the same.

Except, I'm going to try hosting it on AWS. With the website code on S3, the Dev.to requests proxied through API Gateway, and everything sitting behind a Cloudfront distribution.

That should allow HTTPS, cache all requests (incl the ones proxied to Dev.to) for 24 hours, and be dirt cheap to host.

Thread Thread
 
evanplaice profile image
Evan Plaice • Edited

BTW, the component uses lightDOM. Meaning you can style it globally.

Styles can be defined relative to the component. Once parsed, it'll contain the Markdown rendered as HTML. So, you can define styles like this:

wc-markdown > h1 {
  font-size: 18px;
}
Collapse
 
sulmanweb profile image
Sulman Baig

Thanks for your nice article. I also moved my blog site from wordpress to vuejs and netlify. I also wrote an article crediting you here

Collapse
 
tuned profile image
Lorenzo (Mec-iS)

It would be great for me to have something like this but using a lightweight framework like Stimulus or Trimmings

Collapse
 
itachiuchiha profile image
Itachi Uchiha

Great work :)

I'm preparing my blog with Nuxt for a while. This will help me. Thanks.

Collapse
 
codespent profile image
Patrick Hanford

Fantastic! Let me know if you have any questions or figure out some better ways to display the article contents. The biggest challenge with this approach so far is style overrides & syntax highlighting.

Collapse
 
itachiuchiha profile image
Itachi Uchiha

Of course :) Maybe I will permanently move my blog to Dev.

Collapse
 
rohansawant profile image
Rohan Sawant

Dude! This looks soo cool! I love the gif banner on your website.

Stackbit is also an alternative for publishing from dev.to, that takes away bit of the complexity of the setup.

Nice read! 🔥

Collapse
 
codespent profile image
Patrick Hanford

The code typer animation on my site is actually a demonstration of of setInterval with Prism.

It's a bit messy but you can check out the code here.

Thanks a lot! I'll definitely look into Stackbit as well.

Collapse
 
joshuasama profile image
Joshua sama charley

Awesome

Collapse
 
minhpn profile image
MinhPN

Cool!
Could you get document API dev.to for me?
Thanks!