├── .prettierignore ├── .npmrc ├── types ├── index.ts ├── routes │ └── index.tsx └── post │ └── index.tsx ├── .github ├── FUNDING.yml ├── assets │ └── readme.png └── ISSUE_TEMPLATE │ ├── feature_request.md │ └── bug_report.md ├── components ├── motion │ └── staggers │ │ ├── index.ts │ │ └── fade │ │ └── index.tsx ├── footnote │ ├── index.ts │ ├── styles.module.css │ ├── forward-reference │ │ └── index.tsx │ └── back-reference │ │ └── index.tsx ├── preview │ ├── index.tsx │ └── styles.module.css ├── providers │ └── index.tsx ├── footer │ └── index.tsx ├── link │ └── index.tsx ├── image │ └── index.tsx ├── posts │ └── index.tsx ├── screens │ ├── home │ │ └── index.tsx │ └── posts │ │ └── index.tsx ├── post-navigation │ └── index.tsx ├── breadcrumb │ └── index.tsx ├── theme │ └── index.tsx ├── deploy │ └── index.tsx └── on-this-page │ └── index.tsx ├── .vscode ├── extensions.json └── settings.json ├── public ├── preview.png ├── assets │ └── inter │ │ ├── medium.ttf │ │ ├── regular.ttf │ │ └── semi-bold.ttf ├── robots.txt ├── sitemap.xml └── sitemap-0.xml ├── app ├── page.tsx ├── (posts) │ ├── examples │ │ ├── posts │ │ │ └── component-showcase.mdx │ │ ├── page.tsx │ │ └── [slug] │ │ │ └── page.tsx │ ├── layout.tsx │ └── guides │ │ ├── page.tsx │ │ ├── [slug] │ │ └── page.tsx │ │ └── posts │ │ ├── getting-started.mdx │ │ ├── basic-writing-and-formatting-syntax.mdx │ │ └── project-structure.mdx ├── layout.tsx ├── icon.tsx └── api │ └── og │ └── route.tsx ├── next-sitemap.config.js ├── postcss.config.mjs ├── .prettierrc.json ├── lib ├── cn │ └── index.tsx ├── formatter │ └── index.tsx ├── deploy │ └── index.ts ├── og │ └── index.ts └── mdx │ └── index.ts ├── next.config.mjs ├── .gitignore ├── tsconfig.json ├── .stylelintrc.json ├── biome.json ├── LICENSE.md ├── scripts └── update-mdx-timestamps.js ├── package.json ├── README.md ├── tailwind.config.ts ├── mdx-components.tsx └── styles └── main.css /.prettierignore: -------------------------------------------------------------------------------- 1 | *.mdx -------------------------------------------------------------------------------- /.npmrc: -------------------------------------------------------------------------------- 1 | enable-pre-post-scripts=true 2 | -------------------------------------------------------------------------------- /types/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./post"; 2 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: [raphaelsalaja] 2 | -------------------------------------------------------------------------------- /components/motion/staggers/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./fade"; 2 | -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": ["biomejs.biome"] 3 | } 4 | -------------------------------------------------------------------------------- /types/routes/index.tsx: -------------------------------------------------------------------------------- 1 | export const Routes = { 2 | Posts: "app/(posts)", 3 | }; 4 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "mdx-preview.preview.useVscodeMarkdownStyles": false 3 | } 4 | -------------------------------------------------------------------------------- /public/preview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raphaelsalaja/sylph/HEAD/public/preview.png -------------------------------------------------------------------------------- /.github/assets/readme.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raphaelsalaja/sylph/HEAD/.github/assets/readme.png -------------------------------------------------------------------------------- /components/footnote/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./back-reference"; 2 | export * from "./forward-reference"; 3 | -------------------------------------------------------------------------------- /public/assets/inter/medium.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raphaelsalaja/sylph/HEAD/public/assets/inter/medium.ttf -------------------------------------------------------------------------------- /public/assets/inter/regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raphaelsalaja/sylph/HEAD/public/assets/inter/regular.ttf -------------------------------------------------------------------------------- /public/assets/inter/semi-bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raphaelsalaja/sylph/HEAD/public/assets/inter/semi-bold.ttf -------------------------------------------------------------------------------- /app/page.tsx: -------------------------------------------------------------------------------- 1 | import Home from "@/components/screens/home"; 2 | 3 | export default function Page() { 4 | return ; 5 | } 6 | -------------------------------------------------------------------------------- /next-sitemap.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('next-sitemap').IConfig} */ 2 | module.exports = { 3 | siteUrl: process.env.NEXT_PUBLIC_SITE_URL || "https://localhost:3000", 4 | generateRobotsTxt: true, 5 | }; 6 | -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | # * 2 | User-agent: * 3 | Allow: / 4 | 5 | # Host 6 | Host: https://next-sylph-portfolio.vercel.app/ 7 | 8 | # Sitemaps 9 | Sitemap: https://next-sylph-portfolio.vercel.app/sitemap.xml 10 | -------------------------------------------------------------------------------- /postcss.config.mjs: -------------------------------------------------------------------------------- 1 | /** @type {import('postcss-load-config').Config} */ 2 | const config = { 3 | plugins: { 4 | tailwindcss: {}, 5 | "postcss-nested": {}, 6 | }, 7 | }; 8 | 9 | export default config; 10 | -------------------------------------------------------------------------------- /public/sitemap.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | https://next-sylph-portfolio.vercel.app/sitemap-0.xml 4 | -------------------------------------------------------------------------------- /.prettierrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "plugins": ["@ianvs/prettier-plugin-sort-imports"], 3 | "importOrder": ["^(node:)", "", "", "", "^[.]", "", "@/(.*)$", "", "", "", "", "", "^[.]"] 4 | } 5 | -------------------------------------------------------------------------------- /lib/cn/index.tsx: -------------------------------------------------------------------------------- 1 | import type { ClassValue } from "clsx"; 2 | 3 | import { clsx } from "clsx"; 4 | import { twMerge } from "tailwind-merge"; 5 | 6 | export function cn(...inputs: ClassValue[]) { 7 | return twMerge(clsx(inputs)); 8 | } 9 | -------------------------------------------------------------------------------- /app/(posts)/examples/posts/component-showcase.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Component Showcase" 3 | time: 4 | created: "2024-09-18T19:24:46.167Z" 5 | updated: "2024-10-17T09:56:06.853Z" 6 | --- 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /app/(posts)/layout.tsx: -------------------------------------------------------------------------------- 1 | import { Breadcrumb } from "@/components/breadcrumb"; 2 | 3 | import React from "react"; 4 | 5 | export default function Layout({ children }: { children: React.ReactNode }) { 6 | return ( 7 | 8 | 9 | {children} 10 | 11 | ); 12 | } 13 | -------------------------------------------------------------------------------- /next.config.mjs: -------------------------------------------------------------------------------- 1 | import nextMDX from "@next/mdx"; 2 | 3 | /** @type {import('next').NextConfig} */ 4 | const nextConfig = { 5 | reactStrictMode: true, 6 | pageExtensions: ["md", "mdx", "tsx", "ts", "jsx", "js"], 7 | }; 8 | 9 | const withMDX = nextMDX({ 10 | extension: /\.mdx?$/, 11 | }); 12 | 13 | export default withMDX(nextConfig); 14 | -------------------------------------------------------------------------------- /components/preview/index.tsx: -------------------------------------------------------------------------------- 1 | import type React from "react"; 2 | 3 | import styles from "./styles.module.css"; 4 | 5 | const Preview = ({ children, codeblock }: React.HTMLAttributes & { codeblock?: string }) => ( 6 |
7 | {children} 8 |
9 | ); 10 | 11 | export default Preview; 12 | -------------------------------------------------------------------------------- /components/providers/index.tsx: -------------------------------------------------------------------------------- 1 | import { AppThemeProvider } from "@/components/theme"; 2 | 3 | import { ViewTransitions } from "next-view-transitions"; 4 | 5 | export const Providers = ({ children }: { children: React.ReactNode }) => { 6 | return ( 7 | 8 | {children} 9 | 10 | ); 11 | }; 12 | -------------------------------------------------------------------------------- /components/footnote/styles.module.css: -------------------------------------------------------------------------------- 1 | .footnote-back-reference { 2 | text-align: left; 3 | cursor: pointer; 4 | 5 | &:hover { 6 | opacity: 0.8; 7 | } 8 | } 9 | 10 | .footnote-back-reference svg { 11 | width: 12px; 12 | height: 12px; 13 | } 14 | 15 | .footnote-back-reference a { 16 | color: var(--gray-9) !important; 17 | } 18 | 19 | .footnote-forward-reference { 20 | display: inline-block; 21 | margin-right: 2px; 22 | margin-left: 2px; 23 | cursor: pointer; 24 | } 25 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/posts/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | .yarn/install-state.gz 8 | 9 | # testing 10 | /coverage 11 | 12 | # next.js 13 | /.next/ 14 | /out/ 15 | 16 | # production 17 | /build 18 | 19 | # misc 20 | .DS_Store 21 | *.pem 22 | 23 | # debug 24 | npm-debug.log* 25 | yarn-debug.log* 26 | yarn-error.log* 27 | 28 | # local env files 29 | .env*.local 30 | 31 | # vercel 32 | .vercel 33 | 34 | # typescript 35 | *.tsbuildinfo 36 | next-env.d.ts 37 | -------------------------------------------------------------------------------- /components/footer/index.tsx: -------------------------------------------------------------------------------- 1 | import Link from "@/components/link"; 2 | import { AppThemeSwitcher } from "@/components/theme"; 3 | 4 | const Footer = () => { 5 | return ( 6 |
7 |
8 | Built with 9 |
10 |
11 | 12 |
13 |
14 | ); 15 | }; 16 | 17 | export { Footer }; 18 | -------------------------------------------------------------------------------- /lib/formatter/index.tsx: -------------------------------------------------------------------------------- 1 | const date = (input: Date): string => { 2 | return new Intl.DateTimeFormat("en", { 3 | year: "numeric", 4 | month: "short", 5 | day: "numeric", 6 | }).format(input); 7 | }; 8 | 9 | const number = (input: number): string => { 10 | return new Intl.NumberFormat("en", { 11 | style: "decimal", 12 | }).format(input); 13 | }; 14 | 15 | const time = (value: number, unit: Intl.RelativeTimeFormatUnit): string => { 16 | return new Intl.RelativeTimeFormat("en", { 17 | numeric: "auto", 18 | }).format(value, unit); 19 | }; 20 | 21 | export const formatter = { 22 | date, 23 | number, 24 | time, 25 | }; 26 | -------------------------------------------------------------------------------- /components/link/index.tsx: -------------------------------------------------------------------------------- 1 | import clsx from "clsx"; 2 | 3 | interface LinkProps extends React.HTMLProps { 4 | text?: string; 5 | underline?: boolean; 6 | className?: string; 7 | } 8 | 9 | const Link = ({ text, href, underline, className, children }: LinkProps) => { 10 | return ( 11 | 19 | {text || children} 20 | 21 | ); 22 | }; 23 | 24 | export default Link; 25 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: "" 5 | labels: "" 6 | assignees: "" 7 | --- 8 | 9 | **Is your feature request related to a problem? Please describe.** 10 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 11 | 12 | **Describe the solution you'd like** 13 | A clear and concise description of what you want to happen. 14 | 15 | **Describe alternatives you've considered** 16 | A clear and concise description of any alternative solutions or features you've considered. 17 | 18 | **Additional context** 19 | Add any other context or screenshots about the feature request here. 20 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "lib": ["dom", "dom.iterable", "esnext"], 4 | "allowJs": true, 5 | "skipLibCheck": true, 6 | "strict": true, 7 | "noEmit": true, 8 | "esModuleInterop": true, 9 | "module": "esnext", 10 | "moduleResolution": "bundler", 11 | "resolveJsonModule": true, 12 | "isolatedModules": true, 13 | "jsx": "preserve", 14 | "incremental": true, 15 | "plugins": [ 16 | { 17 | "name": "next" 18 | } 19 | ], 20 | "paths": { 21 | "@/*": ["./*"] 22 | } 23 | }, 24 | "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts", "scripts/*.js"], 25 | "exclude": ["node_modules"] 26 | } 27 | -------------------------------------------------------------------------------- /components/preview/styles.module.css: -------------------------------------------------------------------------------- 1 | @tailwind components; 2 | 3 | @layer components { 4 | .preview { 5 | display: flex; 6 | flex-direction: column; 7 | align-items: center; 8 | justify-content: center; 9 | width: 100%; 10 | min-height: 384px; 11 | padding: 48px; 12 | margin-top: 4px; 13 | border-color: var(--border); 14 | border-width: 1px; 15 | border-radius: var(--radius-base); 16 | 17 | &[data-with-codeblock="true"] { 18 | border-bottom-right-radius: 0; 19 | border-bottom-left-radius: 0; 20 | 21 | & + figure { 22 | margin-top: 0; 23 | border-top-width: 0; 24 | border-top-left-radius: 0; 25 | border-top-right-radius: 0; 26 | } 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /app/(posts)/guides/page.tsx: -------------------------------------------------------------------------------- 1 | import * as FadeIn from "@/components/motion/staggers/fade"; 2 | import { Posts } from "@/components/posts"; 3 | import { OpenGraph } from "@/lib/og"; 4 | 5 | import React from "react"; 6 | 7 | export function generateMetadata() { 8 | const title = "Guides"; 9 | const image = `${process.env.NEXT_PUBLIC_SITE_URL}api/og?title=${encodeURIComponent(title)}`; 10 | 11 | return { 12 | ...OpenGraph, 13 | title, 14 | openGraph: { 15 | title, 16 | images: [image], 17 | }, 18 | twitter: { 19 | images: [image], 20 | }, 21 | }; 22 | } 23 | 24 | export default function Page() { 25 | return ( 26 | 27 | 28 | 29 | 30 | 31 | ); 32 | } 33 | -------------------------------------------------------------------------------- /app/(posts)/examples/page.tsx: -------------------------------------------------------------------------------- 1 | import * as FadeIn from "@/components/motion/staggers/fade"; 2 | import { Posts } from "@/components/posts"; 3 | import { OpenGraph } from "@/lib/og"; 4 | 5 | import React from "react"; 6 | 7 | const category = "examples"; 8 | 9 | export function generateMetadata() { 10 | const image = `${process.env.NEXT_PUBLIC_SITE_URL}api/og?title=${encodeURIComponent(category)}`; 11 | 12 | return { 13 | ...OpenGraph, 14 | category, 15 | openGraph: { 16 | category, 17 | images: [image], 18 | }, 19 | twitter: { 20 | images: [image], 21 | }, 22 | }; 23 | } 24 | 25 | export default function Page() { 26 | return ( 27 | 28 | 29 | 30 | 31 | 32 | ); 33 | } 34 | -------------------------------------------------------------------------------- /lib/deploy/index.ts: -------------------------------------------------------------------------------- 1 | const REPOSITORY_URL = "https://github.com/raphaelsalaja/sylph"; 2 | const PROJECT_NAME = "portfolio"; 3 | const REPOSITORY_NAME = "portfolio"; 4 | const REDIRECT_URL = "https://twitter.com/raphaelsalaja"; 5 | const DEMO_TITLE = "next-slyph-portfolio"; 6 | const DEMO_DESCRIPTION = "A minimal blog built with Next.js."; 7 | const DEMO_URL = "https://next-sylph-portfolio.vercel.app"; 8 | const DEMO_IMAGE = "next-sylph-portfolio.vercel.app/preview.png"; 9 | 10 | const DeployLink = `https://vercel.com/new/clone?repository-url=${encodeURIComponent(REPOSITORY_URL)}&env=NEXT_PUBLIC_SITE_URL&project-name=${PROJECT_NAME}&repository-name=${REPOSITORY_NAME}&redirect-url=${encodeURIComponent(REDIRECT_URL)}&demo-title=${DEMO_TITLE}&demo-description=${encodeURIComponent(DEMO_DESCRIPTION)}&demo-url=${encodeURIComponent(DEMO_URL)}&demo-image=${encodeURIComponent(DEMO_IMAGE)}`; 11 | 12 | export { DeployLink }; 13 | -------------------------------------------------------------------------------- /app/layout.tsx: -------------------------------------------------------------------------------- 1 | import "@/styles/main.css"; 2 | 3 | import type { Metadata } from "next"; 4 | 5 | import { Providers } from "@/components/providers"; 6 | import { OpenGraph } from "@/lib/og"; 7 | 8 | import clsx from "clsx"; 9 | import { Inter } from "next/font/google"; 10 | 11 | export const metadata: Metadata = { 12 | ...OpenGraph, 13 | }; 14 | 15 | const inter = Inter({ 16 | subsets: ["latin"], 17 | display: "swap", 18 | }); 19 | 20 | export default function RootLayout({ 21 | children, 22 | }: Readonly<{ 23 | children: React.ReactNode; 24 | }>) { 25 | return ( 26 | 27 | 28 | 29 |
30 |
{children}
31 |
32 |
33 | 34 | 35 | ); 36 | } 37 | -------------------------------------------------------------------------------- /app/icon.tsx: -------------------------------------------------------------------------------- 1 | import { gray } from "@radix-ui/colors"; 2 | import { ImageResponse } from "next/og"; 3 | 4 | export const size = { 5 | width: 32, 6 | height: 32, 7 | }; 8 | export const contentType = "image/png"; 9 | 10 | export default function Icon() { 11 | return new ImageResponse( 12 |
24 |
35 |
, 36 | { 37 | ...size, 38 | }, 39 | ); 40 | } 41 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: "" 5 | labels: "" 6 | assignees: "" 7 | --- 8 | 9 | **Describe the bug** 10 | A clear and concise description of what the bug is. 11 | 12 | **To Reproduce** 13 | Steps to reproduce the behavior: 14 | 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Desktop (please complete the following information):** 27 | 28 | - OS: [e.g. iOS] 29 | - Browser [e.g. chrome, safari] 30 | - Version [e.g. 22] 31 | 32 | **Smartphone (please complete the following information):** 33 | 34 | - Device: [e.g. iPhone6] 35 | - OS: [e.g. iOS8.1] 36 | - Browser [e.g. stock browser, safari] 37 | - Version [e.g. 22] 38 | 39 | **Additional context** 40 | Add any other context about the problem here. 41 | -------------------------------------------------------------------------------- /.stylelintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json.schemastore.org/stylelintrc.json", 3 | "extends": ["stylelint-config-standard", "stylelint-config-recess-order"], 4 | "rules": { 5 | "at-rule-no-unknown": null, 6 | "at-rule-empty-line-before": [ 7 | "always", 8 | { 9 | "except": ["blockless-after-same-name-blockless", "first-nested"] 10 | } 11 | ], 12 | "comment-empty-line-before": [ 13 | "always", 14 | { 15 | "except": ["first-nested"], 16 | "ignore": ["stylelint-commands"] 17 | } 18 | ], 19 | "declaration-empty-line-before": [ 20 | "always", 21 | { 22 | "except": ["after-declaration", "first-nested"] 23 | } 24 | ], 25 | "no-descending-specificity": null, 26 | "no-duplicate-selectors": null, 27 | "order/order": ["at-rules", "custom-properties", "declarations", "rules"], 28 | "rule-empty-line-before": [ 29 | "always", 30 | { 31 | "except": ["first-nested"] 32 | } 33 | ] 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /biome.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://biomejs.dev/schemas/1.9.0/schema.json", 3 | "vcs": { 4 | "enabled": true, 5 | "clientKind": "git", 6 | "useIgnoreFile": true 7 | }, 8 | "files": { 9 | "ignoreUnknown": false, 10 | "ignore": [] 11 | }, 12 | "formatter": { 13 | "ignore": [".next"], 14 | "enabled": true, 15 | "indentStyle": "space", 16 | "indentWidth": 2, 17 | "lineWidth": 160 18 | }, 19 | "organizeImports": { 20 | "enabled": true 21 | }, 22 | "css": { 23 | "formatter": { 24 | "enabled": true 25 | } 26 | }, 27 | "linter": { 28 | "ignore": [".next"], 29 | "enabled": true, 30 | "rules": { 31 | "recommended": true, 32 | "nursery": { 33 | "useSortedClasses": "info" 34 | }, 35 | "correctness": { 36 | "noUnusedImports": "error" 37 | }, 38 | "a11y": { 39 | "noSvgWithoutTitle": "off" 40 | } 41 | } 42 | }, 43 | "javascript": { 44 | "formatter": { 45 | "quoteStyle": "double" 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /components/motion/staggers/fade/index.tsx: -------------------------------------------------------------------------------- 1 | "use client"; 2 | 3 | import { motion } from "framer-motion"; 4 | 5 | const container = { 6 | hidden: {}, 7 | show: { 8 | transition: { 9 | staggerChildren: 0.05, 10 | delayChildren: 0.2, 11 | }, 12 | }, 13 | }; 14 | 15 | const item = { 16 | hidden: { 17 | opacity: 0, 18 | y: 16, 19 | filter: "blur(4px)", 20 | }, 21 | show: { 22 | opacity: 1, 23 | scale: 1, 24 | y: 0, 25 | filter: "blur(0px)", 26 | transition: { 27 | type: "spring", 28 | stiffness: 150, 29 | damping: 19, 30 | mass: 1.2, 31 | }, 32 | }, 33 | }; 34 | 35 | function Container({ children, className }: React.HTMLProps) { 36 | return ( 37 | 38 | {children} 39 | 40 | ); 41 | } 42 | 43 | function Item({ children }: { children: React.ReactNode }) { 44 | return {children}; 45 | } 46 | 47 | export { Container, Item }; 48 | -------------------------------------------------------------------------------- /lib/og/index.ts: -------------------------------------------------------------------------------- 1 | import type { Metadata } from "next/types"; 2 | 3 | export const OpenGraph: Metadata = { 4 | metadataBase: process.env.NEXT_PUBLIC_SITE_URL ? new URL(process.env.NEXT_PUBLIC_SITE_URL) : undefined, 5 | title: { 6 | default: "Sylph", 7 | template: "%s", 8 | }, 9 | description: "...", 10 | keywords: ["Design", "Development", "Engineering"], 11 | openGraph: { 12 | type: "website", 13 | locale: "en_US", 14 | url: process.env.NEXT_PUBLIC_SITE_URL, 15 | title: "Sylph", 16 | description: "...", 17 | images: [`${process.env.NEXT_PUBLIC_SITE_URL}api/og`], 18 | siteName: "Sylph", 19 | }, 20 | twitter: { 21 | card: "summary_large_image", 22 | title: "Sylph", 23 | description: "...", 24 | images: [`${process.env.NEXT_PUBLIC_SITE_URL}api/og`], 25 | }, 26 | robots: { 27 | index: true, 28 | follow: true, 29 | googleBot: { 30 | index: true, 31 | follow: true, 32 | "max-video-preview": -1, 33 | "max-image-preview": "large", 34 | "max-snippet": -1, 35 | }, 36 | }, 37 | }; 38 | -------------------------------------------------------------------------------- /types/post/index.tsx: -------------------------------------------------------------------------------- 1 | export type Post = { 2 | title: string; 3 | slug: string; 4 | content: string; 5 | tags?: string[]; 6 | summary?: string; 7 | 8 | author?: { 9 | name?: string; 10 | link?: string; 11 | handle?: string; 12 | }; 13 | 14 | time: { 15 | created: string; 16 | updated: string; 17 | }; 18 | 19 | media?: { 20 | image?: string; 21 | video?: string; 22 | audio?: string; 23 | }; 24 | 25 | categorization?: { 26 | readingTime?: string; 27 | }; 28 | 29 | seo?: { 30 | title?: string; 31 | description?: string; 32 | keywords?: string[]; 33 | }; 34 | 35 | audience?: { 36 | likes?: number; 37 | views?: number; 38 | comments?: number; 39 | }; 40 | 41 | related?: { 42 | media?: string[]; 43 | links?: string[]; 44 | posts?: string[]; 45 | }; 46 | 47 | social?: { 48 | twitter?: string; 49 | facebook?: string; 50 | linkedin?: string; 51 | instagram?: string; 52 | youtube?: string; 53 | pinterest?: string; 54 | others?: string[]; 55 | }; 56 | }; 57 | -------------------------------------------------------------------------------- /components/footnote/forward-reference/index.tsx: -------------------------------------------------------------------------------- 1 | "use client"; 2 | 3 | import styles from "../styles.module.css"; 4 | 5 | interface Props extends React.HTMLProps { 6 | href: string; 7 | } 8 | 9 | function FootnoteForwardReference({ href, children }: Props): JSX.Element { 10 | const scroll = () => { 11 | const footnote = document.querySelector(`[id="${href.replace("fn-", "fnref-")}"]`); 12 | 13 | if (footnote) { 14 | window.scrollTo({ 15 | top: footnote.getBoundingClientRect().top + window.scrollY, 16 | behavior: "smooth", 17 | }); 18 | } 19 | }; 20 | 21 | return ( 22 | 39 | ); 40 | } 41 | 42 | export default FootnoteForwardReference; 43 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 Raphael Salaja 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /lib/mdx/index.ts: -------------------------------------------------------------------------------- 1 | import type { Post } from "@/types/post"; 2 | 3 | import fs from "fs"; 4 | import path from "path"; 5 | 6 | import matter from "gray-matter"; 7 | 8 | function readFile(filePath: string): Post | null { 9 | try { 10 | const rawContent = fs.readFileSync(filePath, "utf-8"); 11 | const { data, content } = matter(rawContent); 12 | 13 | const slug = path.basename(filePath, path.extname(filePath)); 14 | 15 | return { 16 | ...data, 17 | slug, 18 | content, 19 | } as Post; 20 | } catch (error) { 21 | console.error(`Failed to read or parse the file at ${filePath}:`, error); 22 | return null; 23 | } 24 | } 25 | 26 | function getFiles(dir: string): string[] { 27 | try { 28 | return fs.readdirSync(dir).filter((file) => path.extname(file) === ".mdx"); 29 | } catch (error) { 30 | console.error(`Failed to read directory at ${dir}:`, error); 31 | return []; 32 | } 33 | } 34 | 35 | export function getPosts(directory: string): Post[] { 36 | const files = getFiles(path.join(process.cwd(), "app", "(posts)", directory, "posts")); 37 | return files.map((file) => readFile(path.join(process.cwd(), "app", "(posts)", directory, "posts", file))).filter((post): post is Post => post !== null); 38 | } 39 | -------------------------------------------------------------------------------- /components/footnote/back-reference/index.tsx: -------------------------------------------------------------------------------- 1 | "use client"; 2 | 3 | import styles from "../styles.module.css"; 4 | 5 | interface Props extends React.HTMLProps { 6 | href: string; 7 | } 8 | 9 | function FootnoteBackReference({ href, children }: Props): JSX.Element { 10 | const scroll = () => { 11 | const footnote = document.querySelector(`[id="${href.replace("ref", "")}"]`); 12 | 13 | if (footnote) { 14 | const headerOffset = 100; 15 | const elementPosition = footnote.getBoundingClientRect().top + window.scrollY; 16 | const offsetPosition = elementPosition - headerOffset; 17 | 18 | window.scrollTo({ 19 | top: offsetPosition, 20 | behavior: "smooth", 21 | }); 22 | } 23 | }; 24 | 25 | return ( 26 | 43 | ); 44 | } 45 | 46 | export default FootnoteBackReference; 47 | -------------------------------------------------------------------------------- /app/(posts)/guides/[slug]/page.tsx: -------------------------------------------------------------------------------- 1 | import type { Post } from "@/types"; 2 | 3 | import { Layout } from "@/components/screens/posts"; 4 | import { getPosts } from "@/lib/mdx"; 5 | import { OpenGraph } from "@/lib/og"; 6 | 7 | import { notFound } from "next/navigation"; 8 | 9 | const route = "guides"; 10 | 11 | const Posts = getPosts(route); 12 | 13 | interface PageProps { 14 | params: Post; 15 | } 16 | 17 | export async function generateStaticParams() { 18 | return Posts.map((post) => ({ 19 | slug: `${post.slug}`, 20 | })); 21 | } 22 | 23 | export function generateMetadata({ params }: PageProps) { 24 | const post = Posts.find((post: { slug: string }) => post.slug === params.slug); 25 | const title = post ? post.title : ""; 26 | const image = `${process.env.NEXT_PUBLIC_SITE_URL}api/og?title=${encodeURIComponent(title)}`; 27 | 28 | return { 29 | ...OpenGraph, 30 | title, 31 | openGraph: { 32 | title, 33 | images: [image], 34 | }, 35 | twitter: { 36 | images: [image], 37 | }, 38 | }; 39 | } 40 | 41 | export default function Page({ params }: PageProps) { 42 | const post = Posts.find((post: { slug: string }) => post.slug === params.slug); 43 | 44 | if (!post) { 45 | notFound(); 46 | } 47 | 48 | return ; 49 | } 50 | -------------------------------------------------------------------------------- /app/(posts)/examples/[slug]/page.tsx: -------------------------------------------------------------------------------- 1 | import type { Post } from "@/types"; 2 | 3 | import { Layout } from "@/components/screens/posts"; 4 | import { getPosts } from "@/lib/mdx"; 5 | import { OpenGraph } from "@/lib/og"; 6 | 7 | import { notFound } from "next/navigation"; 8 | 9 | const route = "examples"; 10 | 11 | const Posts = getPosts(route); 12 | 13 | interface PageProps { 14 | params: Post; 15 | } 16 | 17 | export async function generateStaticParams() { 18 | return Posts.map((post) => ({ 19 | slug: `${post.slug}`, 20 | })); 21 | } 22 | 23 | export function generateMetadata({ params }: PageProps) { 24 | const post = Posts.find((post: { slug: string }) => post.slug === params.slug); 25 | const title = post ? post.title : ""; 26 | const image = `${process.env.NEXT_PUBLIC_SITE_URL}api/og?title=${encodeURIComponent(title)}`; 27 | 28 | return { 29 | ...OpenGraph, 30 | title, 31 | openGraph: { 32 | title, 33 | images: [image], 34 | }, 35 | twitter: { 36 | images: [image], 37 | }, 38 | }; 39 | } 40 | 41 | export default function Page({ params }: PageProps) { 42 | const post = Posts.find((post: { slug: string }) => post.slug === params.slug); 43 | 44 | if (!post) { 45 | notFound(); 46 | } 47 | 48 | return ; 49 | } 50 | -------------------------------------------------------------------------------- /components/image/index.tsx: -------------------------------------------------------------------------------- 1 | "use client"; 2 | 3 | import type { ImageProps } from "next/image"; 4 | 5 | import { motion } from "framer-motion"; 6 | import Image from "next/image"; 7 | import React from "react"; 8 | 9 | interface MDXImageProps extends ImageProps { 10 | alt: string; 11 | caption?: string; 12 | } 13 | 14 | export default function MDXImage({ caption, alt, ...props }: MDXImageProps) { 15 | const [isImageLoading, setImageLoading] = React.useState(true); 16 | const href = props.src.toString(); 17 | 18 | return ( 19 | 20 |
21 | {alt} setImageLoading(false)} 36 | {...props} 37 | /> 38 |
39 | {caption && {caption}} 40 |
41 | ); 42 | } 43 | -------------------------------------------------------------------------------- /components/posts/index.tsx: -------------------------------------------------------------------------------- 1 | import { formatter } from "@/lib/formatter"; 2 | import { getPosts } from "@/lib/mdx"; 3 | 4 | import { Link as NextViewTransition } from "next-view-transitions"; 5 | import React from "react"; 6 | 7 | interface PostProps { 8 | category: string; 9 | } 10 | 11 | export const Posts = ({ category }: PostProps) => { 12 | const posts = getPosts(category).sort((a, b) => { 13 | return new Date(b.time.created).getTime() - new Date(a.time.created).getTime(); 14 | }); 15 | 16 | const Seperator = () =>
; 17 | 18 | if (posts.length === 0) { 19 | return null; 20 | } 21 | 22 | return ( 23 |
24 | 25 |

26 | {category} {posts.length > 0 && `(${posts.length})`} 27 |

28 |
29 | 30 | {posts.map((post) => { 31 | return ( 32 | 33 | 34 | 35 |

{post.title}

36 |

{formatter.date(new Date(post.time.created))}

37 |
38 |
39 | ); 40 | })} 41 |
42 | ); 43 | }; 44 | -------------------------------------------------------------------------------- /components/screens/home/index.tsx: -------------------------------------------------------------------------------- 1 | import { DeployButton } from "@/components/deploy"; 2 | import { Footer } from "@/components/footer"; 3 | import * as FadeIn from "@/components/motion/staggers/fade"; 4 | import { Posts } from "@/components/posts"; 5 | 6 | const Spacer = () =>
; 7 | 8 | export default function Home() { 9 | return ( 10 | 11 | 12 |
13 |
14 |

Sylph

15 |

Next.js Portfolio Starter

16 |
17 |
18 |
19 | 20 | 21 |

22 | Sylph is a Next.js Portfolio Starter that you can use to create your own portfolio website. It is designed to be minimal, lightweight, and fast. It is 23 | also highly customizable, so you can easily make it your own. Sylph is perfect for developers, designers, and other creatives who want to showcase 24 | their work. To start using Sylph, you can follow the guides below. 25 |

26 |
27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 |