generated from theodorusclarence/ts-nextjs-tailwind-starter
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add detail page count and link
- Loading branch information
1 parent
c11ba88
commit 1493b46
Showing
8 changed files
with
155 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import * as React from 'react'; | ||
|
||
import clsxm from '@/lib/clsxm'; | ||
|
||
import NextImage, { NextImageProps } from '@/components/NextImage'; | ||
|
||
type FaviconProps = { | ||
fullUrl: string; | ||
} & Omit<NextImageProps, 'src' | 'alt' | 'width' | 'height'>; | ||
|
||
export default function Favicon({ className, fullUrl, ...rest }: FaviconProps) { | ||
const FAVICON_URL = 'https://icons.duckduckgo.com/ip3/'; | ||
const { hostname } = new URL(fullUrl); | ||
|
||
const src = FAVICON_URL + hostname + '.ico'; | ||
|
||
return ( | ||
<NextImage | ||
src={src} | ||
alt={`${hostname} favicon`} | ||
width='20' | ||
height='20' | ||
className={clsxm('', className)} | ||
{...rest} | ||
/> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { NextApiRequest, NextApiResponse } from 'next'; | ||
|
||
import { getUrlBySlug } from '@/lib/notion'; | ||
|
||
export default async function UrlBySlugHandler( | ||
req: NextApiRequest, | ||
res: NextApiResponse | ||
) { | ||
if (req.method === 'GET') { | ||
const { slug } = req.query; | ||
if (!slug) { | ||
return res.status(400).json({ message: 'Missing slug' }); | ||
} | ||
|
||
const url = await getUrlBySlug(slug as string); | ||
|
||
if (!url.pageId) { | ||
return res.status(404).json({ message: 'Not found' }); | ||
} | ||
|
||
res.status(200).json(url); | ||
} else { | ||
res.status(405).json({ message: 'Method Not Allowed' }); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1493b46
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs: