refactor: remove base URL generation and remote image patterns
- Remove `getBaseUrl()` usage in content collections - Update base URL environment variable from `NEXT_PUBLIC_APP_URL` to `NEXT_PUBLIC_BASE_URL` - Remove localhost remote image pattern from Next.js configuration - Add cursor pointer to locale selector items
This commit is contained in:
parent
2f4b8e23fe
commit
cb418af07c
@ -7,7 +7,6 @@ import { codeImport } from 'remark-code-import';
|
||||
import remarkGfm from 'remark-gfm';
|
||||
import { createHighlighter } from 'shiki';
|
||||
import path from "path";
|
||||
import { getBaseUrl } from "@/lib/urls/get-base-url";
|
||||
import { LOCALES, DEFAULT_LOCALE } from "@/i18n/routing";
|
||||
|
||||
/**
|
||||
@ -41,7 +40,6 @@ export const authors = defineCollection({
|
||||
return {
|
||||
...data,
|
||||
locale,
|
||||
avatar: getBaseUrl() + data.avatar
|
||||
};
|
||||
}
|
||||
});
|
||||
@ -157,7 +155,6 @@ export const posts = defineCollection({
|
||||
locale,
|
||||
author: blogAuthor,
|
||||
categories: blogCategories,
|
||||
image: getBaseUrl() + data.image,
|
||||
slug: `/${slugPath}`,
|
||||
slugAsParams,
|
||||
body: {
|
||||
|
@ -16,10 +16,6 @@ const nextConfig: NextConfig = {
|
||||
|
||||
images: {
|
||||
remotePatterns: [
|
||||
{
|
||||
protocol: "http",
|
||||
hostname: "localhost",
|
||||
},
|
||||
{
|
||||
protocol: "https",
|
||||
hostname: "avatars.githubusercontent.com",
|
||||
|
@ -72,7 +72,7 @@ export default function LocaleSelector() {
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
{routing.locales.map((cur) => (
|
||||
<SelectItem key={cur} value={cur} className="flex items-center gap-2">
|
||||
<SelectItem key={cur} value={cur} className="cursor-pointer flex items-center gap-2">
|
||||
<div className="flex items-center gap-2">
|
||||
<span className="text-lg">{LOCALE_LIST[cur].flag}</span>
|
||||
<span>{LOCALE_LIST[cur].name}</span>
|
||||
|
@ -1,7 +1,7 @@
|
||||
// import { DEFAULT_LOCALE } from '@/lib/i18n/locale';
|
||||
|
||||
const baseUrl =
|
||||
process.env.NEXT_PUBLIC_APP_URL ??
|
||||
process.env.NEXT_PUBLIC_BASE_URL ??
|
||||
`http://localhost:${process.env.PORT ?? 3000}`;
|
||||
|
||||
export function getBaseUrl(): string {
|
||||
|
Loading…
Reference in New Issue
Block a user