Giter Site home page Giter Site logo

devspace-blog's Introduction

DevSpace Blog

Static Next.js blog that uses Markdown for posts. Includes pagination, categories and search

This project is part of my Next.js Udemy course

DevSpace Blog

VIEW DEMO

Usage

Install Dependencies

npm install

Run Dev Server (http://localhost:3000)

npm run dev

Creating posts

  • Create a markdown file in the "posts" folder and name it whatever you want as the slug
  • Add the frontmatter/fields at the top and then the post body. See an example in the "posts" folder of this repo
  • Add your cover image and author image in the public/images folder
  • For category color coding, edit the "Components/CategoryLabel.js" file

Caching

Husky is used to run a cache script on git commit. Caching is used for the search api route/serverless function

devspace-blog's People

Contributors

bradtraversy avatar bushblade avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

devspace-blog's Issues

Update 'marked' import in [slug].js

I ran into a webpack issue using marked to display markdown content in the pages/blog/[slug] route. To fix the issue I needed to update the import per below:

import { marked } from 'marked'

Update dynamic styling in CategoryLabel component

The background color is not updating for the blog categories as it seems tailwind will no longer allow dynamic styling. To get around this I updated the color key with the '600' tailwind background hex colors and created dynamically updated inline style per the below:

import Link from "next/link";

export default function CategoryLabel({ children }) {
  const colorKey = {
    JavaScript: "#D97706",
    CSS: "#2563EB",
    Python: "#059669",
    PHP: "#7C3AED",
    Ruby: "#DC2626",
  };

  return (
    <div
      className={`px-2 py-1 text-gray-100 font-bold rounded`}
      style={{ backgroundColor: `${colorKey[children]}` }}
    >
      <Link href={`/blog/category/${children.toLowerCase()}`}>{children}</Link>
    </div>
  );
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.