Refactor guide links and id

pull/1331/head
Kamran Ahmed 3 years ago
parent e800e3b6ce
commit 96e02195a9
  1. 50
      content/guides.json
  2. 2
      lib/guide.ts
  3. 4
      pages/guides/[guide].tsx
  4. 4
      pages/guides/index.tsx
  5. 4
      pages/index.tsx

@ -3,8 +3,6 @@
"id": "ci-cd",
"title": "What is CI and CD?",
"description": "Learn the basics of CI/CD and how to implement that with GitHub Actions.",
"url": "/guides/ci-cd",
"fileName": "ci-cd.md",
"isPro": false,
"authorUsername": "kamranahmedse",
"updatedAt": "2020-07-09T19:59:14.191Z",
@ -14,8 +12,6 @@
"id": "sso",
"title": "SSO — Single Sign On",
"description": "Learn the basics of SAML and understand how does Single Sign On work.",
"url": "/guides/sso",
"fileName": "sso.md",
"isPro": false,
"authorUsername": "kamranahmedse",
"updatedAt": "2020-07-01T19:59:14.191Z",
@ -25,8 +21,6 @@
"id": "oauth",
"title": "OAuth — Open Authorization",
"description": "Learn and understand what is OAuth and how it works",
"url": "/guides/oauth",
"fileName": "oauth.md",
"isPro": false,
"authorUsername": "kamranahmedse",
"updatedAt": "2020-06-28T19:59:14.191Z",
@ -36,8 +30,6 @@
"id": "jwt-authentication",
"title": "JWT Authentication",
"description": "Understand what is JWT authentication and how is it implemented",
"url": "/guides/jwt-authentication",
"fileName": "jwt-authentication.md",
"isPro": false,
"authorUsername": "kamranahmedse",
"updatedAt": "2020-06-20T19:59:14.191Z",
@ -47,8 +39,6 @@
"id": "token-authentication",
"title": "Token Based Authentication",
"description": "Understand what is token based authentication and how it is implemented",
"url": "/guides/token-authentication",
"fileName": "token-authentication.md",
"isPro": false,
"authorUsername": "kamranahmedse",
"updatedAt": "2020-06-02T20:59:14.191Z",
@ -58,8 +48,6 @@
"id": "session-authentication",
"title": "Session Based Authentication",
"description": "Understand what is session based authentication and how it is implemented",
"url": "/guides/session-authentication",
"fileName": "session-authentication.md",
"isPro": false,
"authorUsername": "kamranahmedse",
"updatedAt": "2020-05-26T20:59:14.191Z",
@ -69,8 +57,6 @@
"id": "basic-authentication",
"title": "Basic Authentication",
"description": "Understand what is basic authentication and how it is implemented",
"url": "/guides/basic-authentication",
"fileName": "basic-authentication.md",
"isPro": false,
"authorUsername": "kamranahmedse",
"updatedAt": "2020-05-19T20:59:14.191Z",
@ -80,8 +66,6 @@
"id": "character-encodings",
"title": "Character Encodings",
"description": "Covers the basics of character encodings and explains ASCII vs Unicode",
"url": "/guides/character-encodings",
"fileName": "character-encodings.md",
"isPro": false,
"authorUsername": "kamranahmedse",
"updatedAt": "2020-05-14T20:59:14.191Z",
@ -91,8 +75,6 @@
"id": "unfamiliar-codebase",
"title": "Unfamiliar Codebase",
"description": "Tips on getting getting familiar with an unfamiliar codebase",
"url": "/guides/unfamiliar-codebase",
"fileName": "unfamiliar-codebase.md",
"isPro": false,
"authorUsername": "kamranahmedse",
"updatedAt": "2020-05-04T20:59:14.191Z",
@ -102,8 +84,6 @@
"id": "why-build-it-and-they-will-come-wont-work-anymore",
"title": "Build it and they will come?",
"description": "Why “build it and they will come” alone won’t work anymore",
"url": "/guides/why-build-it-and-they-will-come-wont-work-anymore",
"fileName": "why-build-it-and-they-will-come-wont-work-anymore.md",
"isPro": false,
"authorUsername": "spekulatius",
"updatedAt": "2020-05-04T12:59:14.191Z",
@ -113,8 +93,6 @@
"id": "dhcp-in-one-picture",
"title": "DHCP in One Picture",
"description": "Here is what happens when a new device joins the network.",
"url": "/guides/dhcp-in-one-picture",
"fileName": "dhcp-in-one-picture.md",
"isPro": false,
"authorUsername": "kamranahmedse",
"updatedAt": "2020-04-28T15:48:21.191Z",
@ -124,8 +102,6 @@
"id": "ssl-tls-https-ssh",
"title": "SSL vs TLS vs SSH",
"description": "Quick tidbit on the differences between SSL, TLS, HTTPS and SSH",
"url": "/guides/ssl-tls-https-ssh",
"fileName": "ssl-tls-https-ssh.md",
"isPro": false,
"authorUsername": "kamranahmedse",
"updatedAt": "2020-04-22T15:48:21.191Z",
@ -135,8 +111,6 @@
"id": "asymptotic-notation",
"title": "Asymptotic Notation",
"description": "Learn the basics of measuring the time and space complexity of algorithms",
"url": "/guides/asymptotic-notation",
"fileName": "asymptotic-notation.md",
"isPro": false,
"authorUsername": "kamranahmedse",
"updatedAt": "2020-04-03T15:48:21.191Z",
@ -146,8 +120,6 @@
"id": "big-o-notation",
"title": "Big-O Notation",
"description": "Easy to understand explanation of Big-O notation without any fancy terms",
"url": "/guides/big-o-notation",
"fileName": "big-o-notation.md",
"isPro": false,
"authorUsername": "kamranahmedse",
"updatedAt": "2020-03-15T15:48:21.191Z",
@ -157,8 +129,6 @@
"id": "random-numbers",
"title": "Random Numbers: Are they?",
"description": "Learn how they are generated and why they may not be truly random.",
"url": "/guides/random-numbers",
"fileName": "random-numbers.md",
"isPro": false,
"authorUsername": "kamranahmedse",
"updatedAt": "2020-03-14T15:48:21.191Z",
@ -168,8 +138,6 @@
"id": "scaling-databases",
"title": "Scaling Databases",
"description": "Learn the ups and downs of different database scaling strategies",
"url": "/guides/scaling-databases",
"fileName": "scaling-databases.md",
"isPro": false,
"authorUsername": "kamranahmedse",
"updatedAt": "2020-02-18T15:48:21.191Z",
@ -179,8 +147,6 @@
"id": "what-is-internet",
"title": "How does the internet work?",
"description": "Learn the basics of internet and everything involved with this short video series",
"url": "/guides/what-is-internet",
"fileName": "what-is-internet.md",
"isPro": false,
"authorUsername": "dmytrobol",
"updatedAt": "2020-02-29T15:48:21.191Z",
@ -190,8 +156,6 @@
"id": "torrent-client",
"title": "Building a BitTorrent Client",
"description": "Learn everything you need to know about BitTorrent by writing a client in Go",
"url": "/guides/torrent-client",
"fileName": "torrent-client.md",
"isPro": false,
"authorUsername": "jesse",
"updatedAt": "2020-01-17T15:48:21.191Z",
@ -202,8 +166,6 @@
"id": "levels-of-seniority",
"title": "Levels of Seniority",
"description": "How to Step Up as a Junior, Mid Level or a Senior Developer?",
"url": "/guides/levels-of-seniority",
"fileName": "levels-of-seniority.md",
"isPro": false,
"authorUsername": "kamranahmedse",
"updatedAt": "2019-12-03T12:13:00.860Z",
@ -213,8 +175,6 @@
"id": "design-patterns-for-humans",
"title": "Design Patterns for Humans",
"description": "A language agnostic, ultra-simplified explanation to design patterns",
"url": "/guides/design-patterns-for-humans",
"fileName": "design-patterns-for-humans.md",
"isPro": false,
"authorUsername": "kamranahmedse",
"updatedAt": "2019-10-09T12:00:00.860Z",
@ -224,8 +184,6 @@
"id": "journey-to-http2",
"title": "Journey to HTTP/2",
"description": "The evolution of HTTP. How it all started and where we stand today",
"url": "/guides/journey-to-http2",
"fileName": "journey-to-http2.md",
"isPro": false,
"authorUsername": "kamranahmedse",
"createdAt": "2018-12-04T12:00:00.860Z",
@ -236,8 +194,6 @@
"id": "dns-in-one-picture",
"title": "DNS in One Picture",
"description": "Quick illustrative guide on how a website is found on the internet.",
"url": "/guides/dns-in-one-picture",
"fileName": "dns-in-one-picture.md",
"isPro": false,
"authorUsername": "kamranahmedse",
"updatedAt": "2018-12-04T12:00:00.860Z",
@ -247,8 +203,6 @@
"id": "http-caching",
"title": "HTTP Caching",
"description": "Everything you need to know about web caching",
"url": "/guides/http-caching",
"fileName": "http-caching.md",
"isPro": false,
"authorUsername": "kamranahmedse",
"createdAt": "2018-11-29T17:00:00.860Z",
@ -258,8 +212,6 @@
"id": "history-of-javascript",
"title": "Brief History of JavaScript",
"description": "How JavaScript was introduced and evolved over the years",
"url": "/guides/history-of-javascript",
"fileName": "history-of-javascript.md",
"isPro": false,
"authorUsername": "kamranahmedse",
"createdAt": "2017-10-28T17:00:00.860Z",
@ -269,8 +221,6 @@
"id": "proxy-servers",
"title": "Proxy Servers",
"description": "How do proxy servers work and what are forward and reverse proxies?",
"url": "/guides/proxy-servers",
"fileName": "proxy-servers.md",
"isPro": false,
"authorUsername": "ebrahimbharmal007",
"createdAt": "2020-07-24T12:40:18",

@ -6,8 +6,6 @@ export type GuideType = {
id: string;
title: string;
description: string;
url: string;
fileName: string;
isPro: boolean;
isDraft: boolean;
createdAt: string;

@ -14,7 +14,7 @@ type GuideProps = {
export default function Guide(props: GuideProps) {
const { guide } = props;
const GuideContent = require(`../../content/guides/${guide.fileName}`).default;
const GuideContent = require(`../../content/guides/${guide.id}.md`).default;
return (
<Box bg='white' minH='100vh'>
@ -31,7 +31,7 @@ export default function Guide(props: GuideProps) {
}}
subLink={{
text: 'Improve this Guide',
url: `${siteConfig.url.repo}/tree/master/content/guides/${guide.fileName}`
url: `${siteConfig.url.repo}/tree/master/content/guides/${guide.id}.md`
}}
/>
<Container maxW={'container.md'} position='relative'>

@ -31,8 +31,8 @@ export default function Guides(props: GuidesProps) {
<SimpleGrid columns={[1, 1, 2]} mb='30px' spacing={['10px', '10px', '15px']}>
{recentGuides.map((recentGuide, counter) => (
<GuideGridItem
href={recentGuide.url}
key={recentGuide.id}
href={`/guides/${recentGuide.id}`}
title={recentGuide.title}
subtitle={recentGuide.description}
date={recentGuide.formattedUpdatedAt!}
@ -45,7 +45,7 @@ export default function Guides(props: GuidesProps) {
<LinksList>
{oldGuides.map(oldGuide => (
<LinksListItem
href={oldGuide.url}
href={`/guides/${oldGuide.id}`}
key={oldGuide.id}
title={oldGuide.title}
badgeText={oldGuide.isPro ? 'PRO' : ''}

@ -65,8 +65,8 @@ export default function Home(props: HomeProps) {
<LinksList>
{guides.map(guide => (
<LinksListItem
key={guide.url}
href={guide.url}
key={guide.id}
href={`/guides/${guide.id}`}
title={guide.title}
badgeText={guide.isPro ? 'PRO' : ''}
subtitle={guide.formattedUpdatedAt!}

Loading…
Cancel
Save