Skip to content

feat: category refresh #412

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,15 @@ author: "John Doe"
- Must have the same name.
- This name should be specified in the frontmatter's `cover` property.
- **category:** The `category` property should be a string having all the categories for the blog post separated by a comma. For e.g. if we want a post that is visible in the _Featured_ and _Sessions_ tabs, the value would be `featured, sessions`.
- Category has the following filters:
- **Authentication & Identity**
- **Security & Compliance**
- **Developer Guides & Tutorials**
- **Product Updates & Announcements**
- **Company News & Events**
- **Case Studies & Customer Stories**
- **Industry Insights & Trends**

- **author:** Name of the author of this post.

#### Content for the post
Expand Down
2 changes: 1 addition & 1 deletion content/what-is-credential-stuffing/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: "What is Credential Stuffing?"
description: "Most people are familiar with brute force attacks, where attackers attempt to guess passwords using characters at random paired with common password suggestions, but what is Credential Stuffing? In this we will go over this type of attack and how you can safeguard against it."
date: "2024-02-13"
cover: "what-is-credential-stuffing.png"
category: "programming"
category: "Authentication"
author: "Joel Coutinho"
---

Expand Down
16 changes: 9 additions & 7 deletions gatsby-node.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const { createFilePath } = require(`gatsby-source-filesystem`)

const { categories } = require(`./src/blog-categories`)
const webflowPosts = require("./src/blog-details")
const getBlogCardString = require("./src/getBlogCardString")

Expand Down Expand Up @@ -49,16 +49,18 @@ exports.createPages = async ({ actions, graphql }) => {


const postsAsHTMLString = {
all: "",
sessions: "",
featured: "",
programming: ""
All: "",
Authentication: "",
Security: "",
Tutorials: "",
Announcements: "",
News: "",
}

const allFilters = ["all", "sessions", "featured", "programming"]
const allFilters = [categories.ALL, categories.ANNOUNCEMENTS, categories.AUTHENTICATION, categories.NEWS, categories.SECURITY, categories.SECURITY, categories.TUTORIALS]
allFilters.forEach((filter) => {
postsAsHTMLString[filter] = sortedPosts.filter((post) => {
if (filter === "all") {
if (filter === categories.ALL) {
return true;
}

Expand Down
13 changes: 13 additions & 0 deletions src/blog-categories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@


const categories = {
ALL: "All",
AUTHENTICATION: "Authentication",
SECURITY: "Security",
TUTORIALS: "Tutorials",
ANNOUNCEMENTS: "Announcements",
NEWS: "News",
}
module.exports = {
categories
}
46 changes: 31 additions & 15 deletions src/templates/blog-home.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import * as React from "react"

import "../styles/blog.css"
import { categories } from "../blog-categories";

const BlogHomeTemplate = (props) => {
const [selectedCategory, setSelectedCategory] = React.useState("all");
const [selectedCategory, setSelectedCategory] = React.useState(categories.ALL);
const [classToHideList, setClassToHideList] = React.useState("visible");

React.useEffect(() => {
Expand Down Expand Up @@ -31,31 +32,46 @@ const BlogHomeTemplate = (props) => {
<div className="blog-categories">
<button
id="tab-1-id"
className={`blog-categories__category ${selectedCategory === "all" && "selected"}`}
onClick={() => updateCategory("all")}
>
className={`blog-categories__category ${selectedCategory === categories.ALL && "selected"}`}
onClick={() => updateCategory(categories.ALL)}
>
All
</button>
<button
id="tab-2-id"
className={`blog-categories__category ${selectedCategory === "sessions" && "selected"}`}
onClick={() => updateCategory("sessions")}
>
Sessions
className={`blog-categories__category ${selectedCategory === categories.ANNOUNCEMENTS && "selected"}`}
onClick={() => {updateCategory(categories.ANNOUNCEMENTS)}}
>
Announcements
</button>
<button
id="tab-3-id"
className={`blog-categories__category ${selectedCategory === "featured" && "selected"}`}
onClick={() => updateCategory("featured")}
>
Featured
className={`blog-categories__category ${selectedCategory === categories.AUTHENTICATION && "selected"}`}
onre
onClick={() => updateCategory(categories.AUTHENTICATION)}
>
Authentication
</button>
<button
id="tab-4-id"
className={`blog-categories__category ${selectedCategory === "programming" && "selected"}`}
onClick={() => updateCategory("programming")}
className={`blog-categories__category ${selectedCategory === categories.TUTORIALS && "selected"}`}
onClick={() => updateCategory(categories.TUTORIALS)}
>
Tutorials
</button>
<button
id="tab-5-id"
className={`blog-categories__category ${selectedCategory === categories.SECURITY && "selected"}`}
onClick={() => updateCategory(categories.SECURITY)}
>
Security
</button>
<button
id="tab-6-id"
className={`blog-categories__category ${selectedCategory === categories.NEWS && "selected"}`}
onClick={() => updateCategory(categories.NEWS)}
>
Programming
News
</button>
</div>
</div>
Expand Down
3 changes: 2 additions & 1 deletion static/blog-seo/sitemapconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,8 @@
},
{
"location": "https://supertokens.com/blog/cloud-based-authentication"
}
},
{
"location": "https://supertokens.com/blog/2fa-services"
},
{
Expand Down