Important note
It's all free. The idea here is to get a working solution without spending a penny.
Introduction
I've already...
For further actions, you may consider blocking this person and/or reporting abuse
Thank you so much for sharing this! 💓
I became a Jekyll fan this year, I started to use GitHub as my blog platform.
I cross-post my blog posts here on dev.to, I want to show the discussions from dev.to on the comment section of my blog post.
Think of how to do it
Bash script
I am a noob on bash script, please, feel free to help me.
I will have to get all my posts as you did. Then I will have to grab the comments from each posts.
Help me here: is there a way to grab the comments associated with the post title?
_layout/post.html
I will compare the title from current post with the title from the _data/comments_download and if the title is the same I will print it.
to-do I will have to figure out how to show it as beautiful as dev.to does.
bad idea
I thought to use Javascript to do that, but it will destroy the performance gains from static pages.
@brunodrugowick , I will appreciate if you can advise me 🤗
@renanfranca , I have a few ideas, I can take a look.
But, basically, if the dev.to API allows you to get comments for a post, it's just a matter of creating other static data files for each post with the comments, or even combining the comments on a huge structure.
I'll read the docs and try to make it work later.
@brunodrugowick ! Thank you very much for the feedback 😊!
That will be awesome! Take your time and have a nice week 🙂
Yeah, it's quite easy to do it. Here's the bash script to get the comments for each post saving them to a separate file. My suggestion would be to create a page for each post now. Maybe there's some things to figure out to actually generate each page now from the list of files in bash or maybe there's a way to do this in Jekyll (maybe it would require to save all the comments to the same file, I don't know.
Anyway, here's something with which you can start:
For the other readers I wanna say this is starting to defeat the purpose of my post. The stack I chose was designed to be simple because I had a simple problem to solve. I wouldn't choose the same stack if I needed this to scale.
Having said that, for you, @renanfranca , what I say is "let's do this, let's see what happens". Hahaha. You're still looking for the ideal solution to your problem and you're kinda still defining your problem (or at least that's what it looks like to me). Let's see where this will take you... doing is the best way to learn.
And let me know if you need any help... vejo que é brasileiro, podemos economizar o inglês até. Hahaha.
Thank you very much for the bash script! That's gold 🪙 for me because I Am still learning it ☺️
I will give the feedback for sure!
I am sorry for disturbing the discussion section 😅
---pt-br-----------
Lhe adicionei no twitter, qualquer coisa eu lhe envio uma DM por lá 👍
Here's my new version of the script, closer to what you're looking for:
Thank you so much! I am learning a lot about how bash is powerful because you comment on the script explain what each line does 👏
I will explain what exactly I want to do.
Let's take the following blog post on my website renanfranca.github.io/2022/03/25/w....
I want to bring only the discussion (comments) from the dev.to post dev.to/renanfranca/why-do-i-need-t... to the place highlight at the following image:
If the reader wants to join the discussion I'll put a link to my dev.to post.
My motivation
My blog post on my website isn't the same from dev.to. On my website, I use Jekyll features (ex: embed twitter posts) and I mention other authors by referencing his Twitter, Here at dev.to I use its own embedded markdown style and I reference other authors' dev.to profiles.
I want to bring the discussions to my website because I think those dev.to discussion complement my blog post.
Here is my github website repository in case you're curious: github.com/renanfranca/renanfranca...
nice...
For those of you that are following this, my most recent version only commits when changes are detected.
Here's the action: github.com/brunodrugowick/brunodru...
And the referenced scripts: github.com/brunodrugowick/brunodru...
Cool one
Checkout my GitHub, my latest dev.to posts are automatically updated on my Readme
github.com/DhanushNehru
I didn't mention, but of course you can configure whatever field that comes from the API to show up in your page. The example (and my usage) is quite simple but you can be creative and make it look good.