-
Notifications
You must be signed in to change notification settings - Fork 34
feat: card/blogpost.html
shortcode and assets/js/blog.js
dynamic article fetching
#72
feat: card/blogpost.html
shortcode and assets/js/blog.js
dynamic article fetching
#72
Conversation
…ports Medium articles for now
I get this when trying to do
Would it be bad to put I tried it on my machine and nothing seems to break when I run the website with |
Also, here is the output of
|
Also,, how can I get started using the code? |
Will need help with bootstrap when we meet up again. (1) description too short, big white space in the middle |
Personal tasks to be done
|
Rather than trimming the descriptions programatically, you can do it through css, and let the cards automatically cut the descriptions to an appropriate height that fills remaining space when available. |
Interesting! |
I've found some code for fetching blog posts from a specific user on hashnode. Major problem is the code takes the published blogs from the user not the blog (https://blog.atsign.dev/). So what I can do instead is extract the blogs from all the Atsign employees but this is not a permanent solution. const fetchArticles = async (query, variables = {}) => {
const data = await fetch("https://api.hashnode.com/", {
method: "POST",
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
query,
variables
})
});
return data.json();
}
// const username = `wildgreen`;
// const username = `cpswan`;
// const username = `Bahati365`;
const username = `CynthiaPeter`;
const page = 0;
const articleQuery = `
query GetUserArticles($page: Int!) {
user(username: "${username}") {
publication {
posts(page: $page) {
title
brief
coverImage
slug
}
}
}
}
`;
fetchArticles(articleQuery, {page: 0})
.then(result => {
const articles = result.data.user.publication.posts;
// console.log(result);
articles.forEach(article => {
console.log(article);
});
}); Output
|
Very important commit: 8d603b52 functions:
Limitations:
=================================================== Code const result1 = await getMediumItems();
const result2 = await getHashnodeItems();
const together = [...result1, ...result2];
console.log(together); Output [
{
title: 'Flutter Silicon Valley Meetup #2',
pubDate: '2022-06-03 17:39:03',
author: 'Atsign',
thumbnailUrl: 'https://cdn-images-1.medium.com/max/808/1*Co1A04JT4fhx961EIWYBOA.png',
description: 'Hey Everyone! The team at Atsign recently hosted Flutter Silicon Valley’s second meetup! Flutter Silicon Valley is an event where the Flutter developer community can get together and share in all t...',
link: 'https://medium.com/flutter-community/flutter-silicon-valley-meetup-2-d792b43f7e28?source=rss-f779d31710de------2'
},
{
title: 'atSpaceChat: Students Building for Social Privacy on Flutter',
pubDate: '2022-04-20 18:47:05',
author: 'Atsign',
thumbnailUrl: 'https://cdn-images-1.medium.com/max/1024/1*TR4Vm8eUZZfnNU5Gdztcgg.png',
description: 'Introduction Tired of social media companies like Facebook, YouTube, and Twitter messing with our data? Meet Gefei Zhang, an entrepreneur and student who is single handedly flipping the internet by...',
link: 'https://medium.com/flutter-community/spacechat-students-building-for-social-privacy-on-flutter-183b1346cb82?source=rss-f779d31710de------2'
},
{
title: '“Hamming It Up” with Atsign’s Colin Constable, Creator of CATWEB Mobile App For and By the…',
pubDate: '2022-04-07 23:02:54',
author: 'Atsign',
thumbnailUrl: 'https://cdn-images-1.medium.com/max/1024/1*fHc301_O-Ih1wBeOhWaM3g.png',
description: '“Hamming It Up” with Atsign’s Colin Constable, Creator of CATWEB Mobile App For and By the Ham Radio Community. Colin Constable, AI6BH When the South Londoner, Colin Constable, traipsed down the ro...',
link: 'https://atsigncompany.medium.com/hamming-it-up-with-the-companys-colin-constable-creator-of-catweb-mobile-app-for-and-by-the-eb5b4e308dde?source=rss-f779d31710de------2'
},
{
title: 'Developers, it’s time to #flipoffsocialmedia',
pubDate: '2021-12-05 00:10:11',
author: 'Atsign',
thumbnailUrl: 'https://cdn-images-1.medium.com/max/1024/0*TSLgiZSrKxKWg9V3',
description: 'How’s that for a title? I had to use that title so that it would show up in your social media feeds, and that is exactly the point of this post. If I had used my original title, “Calling all develo...',
link: 'https://atsigncompany.medium.com/developers-its-time-to-flipoffsocialmedia-28de97c1f4f4?source=rss-f779d31710de------2'
},
{
title: 'Building Flutter apps with no backend?',
pubDate: '2021-10-19 13:28:55',
author: 'Atsign',
thumbnailUrl: 'https://cdn-images-1.medium.com/max/1024/0*9DJJ43R8XuSJmkAa',
description: 'It’s possible with the free & open-source atPlatform. As developers, we have to make so many decisions when we start a
new project: What database should I use?What is the best architecture to h...',
link: 'https://medium.com/flutter-community/building-flutter-apps-with-no-backend-9715b764a81e?source=rss-f779d31710de------2'
},
{
title: 'Atsign Core Values',
pubDate: '2021-07-20 18:40:07',
author: 'Atsign',
thumbnailUrl: 'https://cdn-images-1.medium.com/max/1024/1*mgxByEl57BjDDqZBW4SkEw.png',
description: 'At Atsign (formerly The @ Company), we are building a flat organization, where decisions that impact the success of the company will be made at every level. As a group, we put together a list of co...',
link: 'https://atsigncompany.medium.com/the-company-core-values-61de7bf978f8?source=rss-f779d31710de------2'
},
{
title: 'Ask the Founders: Storage & Memory & Servers, Oh My!',
pubDate: '2021-05-29 00:03:38',
author: 'Atsign',
thumbnailUrl: 'https://cdn-images-1.medium.com/max/1000/1*9LT2hxetIEVsvQrQmijmSQ.jpeg',
description: 'Frequently Asked Questions about our private, open-source protocol Photo by Fredy Jacob on UnsplashThe atPlatform is a clever abstraction machine. Perhaps the most abstracted component in the entir...',
link: 'https://atsigncompany.medium.com/ask-the-founders-storage-memory-servers-oh-my-250e302352c0?source=rss-f779d31710de------2'
},
{
title: 'Ask the Founders: Breaking Down the atPlatform',
pubDate: '2021-05-26 05:25:58',
author: 'Atsign',
thumbnailUrl: 'https://cdn-images-1.medium.com/max/1000/1*9WDXtWH1sA53JsH4oTg4dQ.jpeg',
description: 'Frequently Asked Questions about our private, open-source protocol Photo by Matt Palmer on UnsplashWhen it comes to understanding the atPlatform and the atSign, our developers are very good at rais...',
link: 'https://atsigncompany.medium.com/ask-the-founders-breaking-down-the-platform-1ab999d1b9ce?source=rss-f779d31710de------2'
},
{
title: 'If you love your customers, set them free',
pubDate: '2021-05-20 18:00:02',
author: 'Atsign',
thumbnailUrl: 'https://cdn-images-1.medium.com/max/1000/1*OietD5Qtl-OYR_CcQ_6llg.jpeg',
description: 'A post-cookie-era CRM strategy and marketing mantra While watching a show on Animal Planet with my kids, I experienced something I haven’t in years of owning a DVR: commercials. We couldn’t fast-fo...',
link: 'https://atsigncompany.medium.com/if-you-love-your-customers-set-them-free-d9237b7b698?source=rss-f779d31710de------2'
},
{
title: 'Ask the Founders: What is the atPlatform?',
pubDate: '2021-05-19 21:37:46',
author: 'Atsign',
thumbnailUrl: 'https://cdn-images-1.medium.com/max/1024/0*aP8VGvdhn58IETvw',
description: 'Frequently Asked Questions about our private, open-source protocol Image from UnsplashPart of the great thing about working at Atsign is that we get to chat with the developers trying out the atPla...',
link: 'https://atsigncompany.medium.com/ask-the-founders-what-is-the-platform-89cdd644bcde?source=rss-f779d31710de------2'
},
{
title: 'Contributing to an Open-Source GitHub Project',
pubDate: '2021-05-03T22:15:51.851Z',
author: 'WildGreen',
thumbnailUrl: 'https://cdn.hashnode.com/res/hashnode/image/upload/v1620079395708/dFw1lTLIS.png',
description: 'Overview: There are a countless number of open source projects that exist on the Internet, but just how are you meant to add anything to these? What does forking a repository mean? What is a pull r...',
link: 'https://hashnode.com/@wildgreen'
},
{
title: 'What is an atsign and why you need one?',
pubDate: '2022-05-20T11:57:30.943Z',
author: 'CynthiaPeter',
thumbnailUrl: 'https://cdn.hashnode.com/res/hashnode/image/upload/v1653045960070/nE4qu0NBQ.png',
description: 'Introduction Following the questions, I got asked in person and even online, I am taking this opportunity to talk about what an @sign is and why you should get one. First, it is pronounced as ‘at-...',
link: 'https://hashnode.com/@CynthiaPeter'
},
{
title: 'Deploying and Managing Your Machine Learning Pipeline with Terraform and Doppler',
pubDate: '2021-11-24T12:00:29.577Z',
author: 'CynthiaPeter',
thumbnailUrl: 'https://cdn.hashnode.com/res/hashnode/image/upload/v1637755006544/1_Mh5lD0w.jpeg',
description: 'Outline Please complete in as much detail as possible. Introduction to ML pipeline Brief intro to Terraform and doppler Setting up Doppler Installing Terraform and AWS to set up model infrastructu...',
link: 'https://hashnode.com/@CynthiaPeter'
},
{
title: 'Flutterflow celebrates one year Anniversary and over 60,000 Builders.🎉🎉🎉',
pubDate: '2021-11-04T11:15:20.062Z',
author: 'CynthiaPeter',
thumbnailUrl: 'https://cdn.hashnode.com/res/hashnode/image/upload/v1636018340570/6jmyeUpJR.jpeg',
description: "Flutterflow celebrates its First Anniversary and closes in on 60,000+ builders. This may be the first time you're reading about Flutterflow or maybe the first time you're seeing it on your screen. ...",
link: 'https://hashnode.com/@CynthiaPeter'
},
{
title: 'Most Common Questions About Technical Writing Answered',
pubDate: '2021-09-30T15:10:20.751Z',
author: 'CynthiaPeter',
thumbnailUrl: 'https://cdn.hashnode.com/res/hashnode/image/upload/v1633014066780/8pd2j1BFX.jpeg',
description: 'In a previous article, you learned what technical writing is. Who is a technical writer? How to get started with technical
writing and some basics. After the previous article, I received a couple o...',
link: 'https://hashnode.com/@CynthiaPeter'
},
{
title: "A beginners' guide to get started with Technical Writing",
pubDate: '2021-09-22T21:26:39.077Z',
author: 'CynthiaPeter',
thumbnailUrl: 'https://cdn.hashnode.com/res/hashnode/image/upload/v1632345513014/e-7JMBKJC.jpeg',
description: "In the past few months, I have spoken at events where I was asked 'how do I get started with technical writing?' Most recently, I received over 5 direct messages(DM's) on Twitter asking me how they...",
link: 'https://hashnode.com/@CynthiaPeter'
},
{
title: 'Advantages of Using Flutter as A Cross-Platform Development tool.',
pubDate: '2021-09-22T21:11:18.716Z',
author: 'CynthiaPeter',
thumbnailUrl: 'https://cdn.hashnode.com/res/hashnode/image/upload/v1632344771812/uD70tC6ID.jpeg',
description: 'In the past 2 years, the software development community has recorded a great increase in the use of Google Flutter SDK. And as a result of this, we have more people asking questions and wondering w...',
link: 'https://hashnode.com/@CynthiaPeter'
}
] |
@JeremyTubongbanua I don't like the idea of using a list of usernames, in case someone decides to publish something more personal to their account. Hashnode also has an rss feed, for which we could do something similar to medium. |
card/blogpost
template (shortcode and shortcode tutorial)card/blogpost.html
shortcode and assets/js/blog.js
dynamic article fetching
Example of one of the hashnode articles (via https://blog.atsign.dev/rss.xml) {
title: 'The at_contacts_flutter library on the @platform',
author: 'Damien Bahati',
thumbnailUrl: 'https://cdn.hashnode.com/res/hashnode/image/upload/v1628090494502/gsBuTxAFW.png',
pubDate: '2021-08-09 18:13:55',
description: 'Too many atSigns to keep track of? Thats no problem with the at_contacts_flutter package! Simply add the at_contacts_flutter dependency to your project, and youll be capable
of performing several a...',
link: 'https://blog.atsign.dev/the-atcontactsflutter-library-on-the-platform-cks4yei3001mjfcs16lwphn1x'
} |
Am not working on this, but it just occurred to me that Hugo is a static site generator So is dynamic content even possible @XavierChanth ? |
legacy due to #94 , closing this PR. |
What this PR is for:
card/blogpost.html
shortcodecontribute
page for using this shortcode.