diff --git a/components/blog/OptimizedImage.tsx b/components/blog/OptimizedImage.tsx index 6f87d8a..5c97eed 100644 --- a/components/blog/OptimizedImage.tsx +++ b/components/blog/OptimizedImage.tsx @@ -43,9 +43,8 @@ export function OptimizedImage({ width={width} height={height} priority={priority} - className={`w-full h-auto transition-opacity duration-300 ${ - isLoading ? 'opacity-0' : 'opacity-100' - }`} + style={{ maxWidth: '100%', height: 'auto' }} + className={`transition-opacity duration-300 ${isLoading ? 'opacity-0' : 'opacity-100'}`} onLoad={() => setIsLoading(false)} onError={() => setHasError(true)} placeholder="blur" diff --git a/content/blog/example.md b/content/blog/example.md index 2d11347..fc2666f 100644 --- a/content/blog/example.md +++ b/content/blog/example.md @@ -25,6 +25,10 @@ export default function Page() { } ``` +### Check out this article: + +[Check this out](tech/articol-tehnic.md) + ## Conclusion Next.js 15 brings many improvements for building modern web applications. diff --git a/content/blog/tech/articol-tehnic.md b/content/blog/tech/articol-tehnic.md index 11a1acc..8f7ea39 100644 --- a/content/blog/tech/articol-tehnic.md +++ b/content/blog/tech/articol-tehnic.md @@ -1,45 +1,16 @@ --- -title: 'Articol Tehnic din Subdirector' -description: 'Test pentru subdirectoare și organizare ierarhică' +title: 'Technical Article' +description: 'A technical article to test internal links' date: '2025-01-10' -author: 'Tech Writer' -category: 'Tehnologie' -tags: ['nextjs', 'react', 'typescript'] -draft: false +author: 'John Doe' +category: 'Tech' +tags: ['tech', 'test'] --- -# Articol Tehnic +# Technical Article -Acesta este un articol stocat într-un subdirector pentru a testa funcționalitatea de organizare ierarhică. +This is a test article for internal blog post linking. -## Next.js și React +## Content -Next.js este un framework React puternic care oferă: - -- Server-side rendering (SSR) -- Static site generation (SSG) -- API routes -- File-based routing - -## Exemplu de cod TypeScript - -```typescript -interface User { - id: number - name: string - email: string -} - -async function fetchUser(id: number): Promise { - const response = await fetch(`/api/users/${id}`) - return response.json() -} -``` - -### Use of coolers - -- ![Use of coolers](./cooler.jpg?w=400&h=300) - -## Concluzie - -Subdirectoarele funcționează perfect pentru organizarea conținutului! +You are reading the technical article that was linked from the example post. diff --git a/lib/markdown.ts b/lib/markdown.ts index 950423f..86674f8 100644 --- a/lib/markdown.ts +++ b/lib/markdown.ts @@ -6,6 +6,7 @@ import remarkGfm from 'remark-gfm' import { FrontMatter, Post } from './types/frontmatter' import { generateExcerpt } from './utils' import { remarkCopyImages } from './remark-copy-images' +import { remarkInternalLinks } from './remark-internal-links' const POSTS_PATH = path.join(process.cwd(), 'content', 'blog') @@ -75,6 +76,7 @@ export async function getPostBySlug(slug: string | string[]): Promise { + visit(tree, 'link', (node: Node) => { + const linkNode = node as LinkNode + + if (isInternalBlogLink(linkNode.url)) { + linkNode.url = transformToBlogPath(linkNode.url) + } + }) + } +} diff --git a/next-env.d.ts b/next-env.d.ts index 9edff1c..c4b7818 100644 --- a/next-env.d.ts +++ b/next-env.d.ts @@ -1,6 +1,6 @@ /// /// -import "./.next/types/routes.d.ts"; +import "./.next/dev/types/routes.d.ts"; // NOTE: This file should not be edited // see https://nextjs.org/docs/app/api-reference/config/typescript for more information.