Skip to content

Commit

Permalink
customize styles and components
Browse files Browse the repository at this point in the history
  • Loading branch information
oerts committed Dec 22, 2024
1 parent f15d52c commit 2182574
Show file tree
Hide file tree
Showing 14 changed files with 233 additions and 227 deletions.
8 changes: 8 additions & 0 deletions .zed/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Folder-specific settings
//
// For a full list of overridable settings, and general information on folder-specific settings,
// see the documentation: https://zed.dev/docs/configuring-zed#settings-files
{
"formatter": "auto",
"format_on_save": "on"
}
42 changes: 0 additions & 42 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,42 +0,0 @@
# Portfolio Blog Starter

This is a porfolio site template complete with a blog. Includes:

- MDX and Markdown support
- Optimized for SEO (sitemap, robots, JSON-LD schema)
- RSS Feed
- Dynamic OG images
- Syntax highlighting
- Tailwind v4
- Vercel Speed Insights / Web Analytics
- Geist font

## Demo

https://portfolio-blog-starter.vercel.app

## How to Use

You can choose from one of the following two methods to use this repository:

### One-Click Deploy

Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_medium=readme&utm_campaign=vercel-examples):

[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https://github.com/vercel/examples/tree/main/solutions/blog&project-name=blog&repository-name=blog)

### Clone and Deploy

Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [pnpm](https://pnpm.io/installation) to bootstrap the example:

```bash
pnpm create next-app --example https://github.com/vercel/examples/tree/main/solutions/blog blog
```

Then, run Next.js in development mode:

```bash
pnpm dev
```

Deploy it to the cloud with [Vercel](https://vercel.com/templates) ([Documentation](https://nextjs.org/docs/app/building-your-application/deploying)).
48 changes: 25 additions & 23 deletions app/blog/[slug]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,39 +1,40 @@
import { notFound } from 'next/navigation'
import { CustomMDX } from 'app/components/mdx'
import { formatDate, getBlogPosts } from 'app/blog/utils'
import { baseUrl } from 'app/sitemap'
import { notFound } from "next/navigation";
import { CustomMDX } from "app/components/mdx";
import { formatDate, getBlogPosts } from "app/blog/utils";
import { baseUrl } from "app/sitemap";

export async function generateStaticParams() {
let posts = getBlogPosts()
let posts = getBlogPosts();

return posts.map((post) => ({
slug: post.slug,
}))
}));
}

export function generateMetadata({ params }) {
let post = getBlogPosts().find((post) => post.slug === params.slug)
export async function generateMetadata({ params }) {
const slug = await params;
let post = getBlogPosts().find((post) => post.slug === slug);
if (!post) {
return
return;
}

let {
title,
publishedAt: publishedTime,
summary: description,
image,
} = post.metadata
} = post.metadata;
let ogImage = image
? image
: `${baseUrl}/og?title=${encodeURIComponent(title)}`
: `${baseUrl}/og?title=${encodeURIComponent(title)}`;

return {
title,
description,
openGraph: {
title,
description,
type: 'article',
type: "article",
publishedTime,
url: `${baseUrl}/blog/${post.slug}`,
images: [
Expand All @@ -43,30 +44,31 @@ export function generateMetadata({ params }) {
],
},
twitter: {
card: 'summary_large_image',
card: "summary_large_image",
title,
description,
images: [ogImage],
},
}
};
}

export default function Blog({ params }) {
let post = getBlogPosts().find((post) => post.slug === params.slug)
export default async function Blog({ params }) {
const { slug } = await params;
let post = getBlogPosts().find((post) => post.slug === slug);

if (!post) {
notFound()
notFound();
}

return (
<section>
<section className="grow">
<script
type="application/ld+json"
suppressHydrationWarning
dangerouslySetInnerHTML={{
__html: JSON.stringify({
'@context': 'https://schema.org',
'@type': 'BlogPosting',
"@context": "https://schema.org",
"@type": "BlogPosting",
headline: post.metadata.title,
datePublished: post.metadata.publishedAt,
dateModified: post.metadata.publishedAt,
Expand All @@ -76,8 +78,8 @@ export default function Blog({ params }) {
: `/og?title=${encodeURIComponent(post.metadata.title)}`,
url: `${baseUrl}/blog/${post.slug}`,
author: {
'@type': 'Person',
name: 'My Portfolio',
"@type": "Person",
name: "Oz Ertas",
},
}),
}}
Expand All @@ -94,5 +96,5 @@ export default function Blog({ params }) {
<CustomMDX source={post.content} />
</article>
</section>
)
);
}
14 changes: 7 additions & 7 deletions app/blog/page.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { BlogPosts } from 'app/components/posts'
import { BlogPosts } from "app/components/posts";

export const metadata = {
title: 'Blog',
description: 'Read my blog.',
}
title: "Oz's blog",
description: "A blog about code and nonsense",
};

export default function Page() {
return (
<section>
<h1 className="font-semibold text-2xl mb-8 tracking-tighter">My Blog</h1>
<section className="grow">
<h1 className="font-semibold text-2xl mb-8 tracking-tighter">Posts</h1>
<BlogPosts />
</section>
)
);
}
23 changes: 6 additions & 17 deletions app/components/footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ function ArrowIcon() {
fill="currentColor"
/>
</svg>
)
);
}

export default function Footer() {
return (
<footer className="mb-16">
<ul className="font-sm mt-8 flex flex-col space-x-0 space-y-2 text-neutral-600 md:flex-row md:space-x-4 md:space-y-0 dark:text-neutral-300">
<footer className="mb-4 flex justify-between items-center border-t border-red-400 mt-4 pt-4">
<ul className="font-sm flex flex-col space-x-0 space-y-2 text-neutral-600 md:flex-row md:space-x-4 md:space-y-0 dark:text-neutral-300">
<li>
<a
className="flex items-center transition-all hover:text-neutral-800 dark:hover:text-neutral-100"
Expand All @@ -35,27 +35,16 @@ export default function Footer() {
className="flex items-center transition-all hover:text-neutral-800 dark:hover:text-neutral-100"
rel="noopener noreferrer"
target="_blank"
href="https://github.com/vercel/next.js"
href="https://github.com/oerts/ertas"
>
<ArrowIcon />
<p className="ml-2 h-7">github</p>
</a>
</li>
<li>
<a
className="flex items-center transition-all hover:text-neutral-800 dark:hover:text-neutral-100"
rel="noopener noreferrer"
target="_blank"
href="https://vercel.com/templates/next.js/portfolio-starter-kit"
>
<ArrowIcon />
<p className="ml-2 h-7">view source</p>
</a>
</li>
</ul>
<p className="mt-8 text-neutral-600 dark:text-neutral-300">
<p className="text-neutral-600 dark:text-neutral-300">
© {new Date().getFullYear()} MIT Licensed
</p>
</footer>
)
);
}
34 changes: 23 additions & 11 deletions app/components/nav.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,33 @@
import Link from 'next/link'
import Image from "next/image";
import Link from "next/link";

const navItems = {
'/': {
name: 'home',
"/": {
name: "home",
},
'/blog': {
name: 'blog',
"/blog": {
name: "blog",
},
'https://vercel.com/templates/next.js/portfolio-starter-kit': {
name: 'deploy',
"/projects": {
name: "projects",
},
}
"/contact": {
name: "contact",
},
};

export function Navbar() {
return (
<aside className="-ml-[8px] mb-16 tracking-tight">
<div className="lg:sticky lg:top-20">
<div className="lg:sticky lg:top-20 flex items-center justify-between">
<div className="flex items-center gap-4">
<Image
src="/logo.svg"
alt="two half circles separated by a gap forming o and z"
width="40"
height="40"
/>
</div>
<nav
className="flex flex-row items-start relative px-0 pb-0 fade md:overflow-auto scroll-pr-6 md:relative"
id="nav"
Expand All @@ -30,11 +42,11 @@ export function Navbar() {
>
{name}
</Link>
)
);
})}
</div>
</nav>
</div>
</aside>
)
);
}
Binary file added app/favicon.ico
Binary file not shown.
Loading

0 comments on commit 2182574

Please sign in to comment.