更新env环境变量里面的SITE_URL为PUBLIC_SITE_URL

This commit is contained in:
jingrow 2025-07-15 13:35:08 +08:00
parent b7ad89b269
commit 22348cd288
5 changed files with 224 additions and 19 deletions

View File

@ -9,7 +9,7 @@ export async function POST(req) {
return new Response('Unauthorized', { status: 401 });
}
const slugs = await getAllSlugs();
const siteUrl = process.env.SITE_URL || 'https://yourdomain.com';
const siteUrl = process.env.PUBLIC_SITE_URL || 'https://yourdomain.com';
const urls = slugs.map(slugArr => {
if (slugArr.length === 1 && slugArr[0] === '/') {
return '/';

View File

@ -6,7 +6,7 @@ export const revalidate = 3600;
export async function generateMetadata() {
const slugArr = ["contact"];
const res = await fetch(`${process.env.SITE_URL}/api/get-page-data`, {
const res = await fetch(`${process.env.PUBLIC_SITE_URL}/api/get-page-data`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ slug_list: slugArr })
@ -25,7 +25,7 @@ export async function generateMetadata() {
}
export default async function ContactPage() {
const res = await fetch(`${process.env.SITE_URL}/api/get-component-data?component_name=Contact`, { cache: 'no-store' });
const res = await fetch(`${process.env.PUBLIC_SITE_URL}/api/get-component-data?component_name=Contact`, { cache: 'no-store' });
const { data } = await res.json();
return (

View File

@ -1,5 +1,5 @@
/** @type {import('next').NextConfig} */
const allowedDevOrigins = process.env.SITE_URL ? [process.env.SITE_URL] : [];
const allowedDevOrigins = process.env.PUBLIC_SITE_URL ? [process.env.PUBLIC_SITE_URL] : [];
const nextConfig = {
images: {
unoptimized: true,

View File

@ -7,72 +7,277 @@
<priority>0.7</priority>
</url>
<url>
<loc>http://192.168.2.200:3001/use-cases/ce-shi-biao-ti-4</loc>
<loc>http://192.168.2.200:3001/products/fruit-powders/test006</loc>
<changefreq>weekly</changefreq>
<priority>0.7</priority>
</url>
<url>
<loc>http://192.168.2.200:3001/use-cases/ce-shi-biao-ti-1</loc>
<loc>http://192.168.2.200:3001/products/mushroom-extracts/organic-snow-mushroom-extract</loc>
<changefreq>weekly</changefreq>
<priority>0.7</priority>
</url>
<url>
<loc>http://192.168.2.200:3001/use-cases/ce-shi-biao-ti-13</loc>
<loc>http://192.168.2.200:3001/products/fruit-powders/organic-extract-natural-pigment-fruit-powder-organic-raspberry-powder-green-pure-powder-extract-powder-food-grade-organic</loc>
<changefreq>weekly</changefreq>
<priority>0.7</priority>
</url>
<url>
<loc>http://192.168.2.200:3001/use-cases/ce-shi-biao-ti-6</loc>
<loc>http://192.168.2.200:3001/products</loc>
<changefreq>weekly</changefreq>
<priority>0.7</priority>
</url>
<url>
<loc>http://192.168.2.200:3001/use-cases/ce-shi-biao-ti-7</loc>
<loc>http://192.168.2.200:3001/products/mushroom-extracts/organic-organic-chaga-mushroom-extract</loc>
<changefreq>weekly</changefreq>
<priority>0.7</priority>
</url>
<url>
<loc>http://192.168.2.200:3001/use-cases/ce-shi-biao-ti-2</loc>
<loc>http://192.168.2.200:3001/products/algae-extract/organic-cbd-full-spectrum-pure-thc-free-high-quality-no-pesticide-residue-no-heavy-metal-residue-cbd-distillated-oil-refined-oil</loc>
<changefreq>weekly</changefreq>
<priority>0.7</priority>
</url>
<url>
<loc>http://192.168.2.200:3001/use-cases/ce-shi-biao-ti-8</loc>
<loc>http://192.168.2.200:3001/products/mushroom-extracts/organic-chaga-mushroom-powder</loc>
<changefreq>weekly</changefreq>
<priority>0.7</priority>
</url>
<url>
<loc>http://192.168.2.200:3001/use-cases/ce-shi-biao-ti-5</loc>
<loc>http://192.168.2.200:3001/products/mushroom-extracts/organic-organic-turkey-tail-extract</loc>
<changefreq>weekly</changefreq>
<priority>0.7</priority>
</url>
<url>
<loc>http://192.168.2.200:3001/use-cases/ce-shi-biao-ti-10</loc>
<loc>http://192.168.2.200:3001/products/ratio-extract/organic-tribulus-terrestris-extract</loc>
<changefreq>weekly</changefreq>
<priority>0.7</priority>
</url>
<url>
<loc>http://192.168.2.200:3001/use-cases/ce-shi-biao-ti-3</loc>
<loc>http://192.168.2.200:3001/products/mushroom-extracts/organic-organic-lions-mane-mushroom-extract</loc>
<changefreq>weekly</changefreq>
<priority>0.7</priority>
</url>
<url>
<loc>http://192.168.2.200:3001/use-cases/ce-shi-biao-ti-12</loc>
<loc>http://192.168.2.200:3001/products/fruit-powders</loc>
<changefreq>weekly</changefreq>
<priority>0.7</priority>
</url>
<url>
<loc>http://192.168.2.200:3001/use-cases</loc>
<loc>http://192.168.2.200:3001/products/algae-extract/Test003</loc>
<changefreq>weekly</changefreq>
<priority>0.7</priority>
</url>
<url>
<loc>http://192.168.2.200:3001/use-cases/ce-shi-biao-ti-11</loc>
<loc>http://192.168.2.200:3001/products/algae-extract</loc>
<changefreq>weekly</changefreq>
<priority>0.7</priority>
</url>
<url>
<loc>http://192.168.2.200:3001/use-cases/ce-shi-biao-ti-9</loc>
<loc>http://192.168.2.200:3001/products/vegetable-powders</loc>
<changefreq>weekly</changefreq>
<priority>0.7</priority>
</url>
<url>
<loc>http://192.168.2.200:3001/project001</loc>
<changefreq>weekly</changefreq>
<priority>0.7</priority>
</url>
<url>
<loc>http://192.168.2.200:3001/products/vegetable-powders/organic-good-quality-plant-extract-natural-pigment-vegetablepowder-freeze-dried-organic-pure-water-kale-powder</loc>
<changefreq>weekly</changefreq>
<priority>0.7</priority>
</url>
<url>
<loc>http://192.168.2.200:3001/page001</loc>
<changefreq>weekly</changefreq>
<priority>0.7</priority>
</url>
<url>
<loc>http://192.168.2.200:3001/products/algae-extract/test002</loc>
<changefreq>weekly</changefreq>
<priority>0.7</priority>
</url>
<url>
<loc>http://192.168.2.200:3001/products/fruit-powders/test007</loc>
<changefreq>weekly</changefreq>
<priority>0.7</priority>
</url>
<url>
<loc>http://192.168.2.200:3001/products/algae-extract/organic-water-soluble-and-non-toxic-food-pigment-extracted-and-processed-from-spirulina-platensis-spirulina-blue-spirulina-extract</loc>
<changefreq>weekly</changefreq>
<priority>0.7</priority>
</url>
<url>
<loc>http://192.168.2.200:3001/products/vegetable-powders/organic-best-price-organic-supply-vegetable-grade-powder-100pure-green-vegetable-powder</loc>
<changefreq>weekly</changefreq>
<priority>0.7</priority>
</url>
<url>
<loc>http://192.168.2.200:3001/products/fruit-powders/organic-healthy-without-pesticide-residues-fruit-fiber-organic-super-freeze-dried-organic-pure-water-fruit-powder-organic-orange-powder</loc>
<changefreq>weekly</changefreq>
<priority>0.7</priority>
</url>
<url>
<loc>http://192.168.2.200:3001/products/fruit-powders/test008</loc>
<changefreq>weekly</changefreq>
<priority>0.7</priority>
</url>
<url>
<loc>http://192.168.2.200:3001/products/mushroom-extracts</loc>
<changefreq>weekly</changefreq>
<priority>0.7</priority>
</url>
<url>
<loc>http://192.168.2.200:3001/products/fruit-powders/organic-best-price-organic-freeze-dried-organic-pure-goji-berry-powder</loc>
<changefreq>weekly</changefreq>
<priority>0.7</priority>
</url>
<url>
<loc>http://192.168.2.200:3001/products/mushroom-extracts/organic-organic-tremella-extract</loc>
<changefreq>weekly</changefreq>
<priority>0.7</priority>
</url>
<url>
<loc>http://192.168.2.200:3001/products/ratio-extract/organic-white-kidney-bean-extract</loc>
<changefreq>weekly</changefreq>
<priority>0.7</priority>
</url>
<url>
<loc>http://192.168.2.200:3001/products/mushroom-extracts/organic-oyster-mushroom-powder</loc>
<changefreq>weekly</changefreq>
<priority>0.7</priority>
</url>
<url>
<loc>http://192.168.2.200:3001/products/algae-extract/test005</loc>
<changefreq>weekly</changefreq>
<priority>0.7</priority>
</url>
<url>
<loc>http://192.168.2.200:3001/products/vegetable-powders/organic-vegetable-seasoning-powder-freeze-dried-organic-pure-quality-barley-grass-powde</loc>
<changefreq>weekly</changefreq>
<priority>0.7</priority>
</url>
<url>
<loc>http://192.168.2.200:3001/products/algae-extract/test001</loc>
<changefreq>weekly</changefreq>
<priority>0.7</priority>
</url>
<url>
<loc>http://192.168.2.200:3001/products/vegetable-powders/organic-organic-super-green-powder-supply-food-gradevegetable-powder-wheatgrass-powder</loc>
<changefreq>weekly</changefreq>
<priority>0.7</priority>
</url>
<url>
<loc>http://192.168.2.200:3001/products/ratio-extract/organic-ashwagandha-extract</loc>
<changefreq>weekly</changefreq>
<priority>0.7</priority>
</url>
<url>
<loc>http://192.168.2.200:3001/about</loc>
<changefreq>weekly</changefreq>
<priority>0.7</priority>
</url>
<url>
<loc>http://192.168.2.200:3001/products/ratio-extract/organic-burdock-extract</loc>
<changefreq>weekly</changefreq>
<priority>0.7</priority>
</url>
<url>
<loc>http://192.168.2.200:3001/products/fruit-powders/organic-organic-pure-quality-best-price-organic-supply-fruit-grade-powder-cranberry-powder</loc>
<changefreq>weekly</changefreq>
<priority>0.7</priority>
</url>
<url>
<loc>http://192.168.2.200:3001/products/vegetable-powders/organic-vegetable-powder-spinach-extract-powder-organic-pure-quality</loc>
<changefreq>weekly</changefreq>
<priority>0.7</priority>
</url>
<url>
<loc>http://192.168.2.200:3001/news</loc>
<changefreq>weekly</changefreq>
<priority>0.7</priority>
</url>
<url>
<loc>http://192.168.2.200:3001/products/mushroom-extracts/organic-organic-cordyceps-militaris-extract</loc>
<changefreq>weekly</changefreq>
<priority>0.7</priority>
</url>
<url>
<loc>http://192.168.2.200:3001/news/test-news</loc>
<changefreq>weekly</changefreq>
<priority>0.7</priority>
</url>
<url>
<loc>http://192.168.2.200:3001/contact</loc>
<changefreq>weekly</changefreq>
<priority>0.7</priority>
</url>
<url>
<loc>http://192.168.2.200:3001/products/fruit-powders/organic-fruit-fiber-organic-super-powder-organic-pure-quality-freeze-dried-extract-blueberry-powder</loc>
<changefreq>weekly</changefreq>
<priority>0.7</priority>
</url>
<url>
<loc>http://192.168.2.200:3001/products/ratio-extract</loc>
<changefreq>weekly</changefreq>
<priority>0.7</priority>
</url>
<url>
<loc>http://192.168.2.200:3001/products/ratio-extract/organic-schisandra-extract</loc>
<changefreq>weekly</changefreq>
<priority>0.7</priority>
</url>
<url>
<loc>http://192.168.2.200:3001/products/mushroom-extracts/organic-organic-maitake-mushroom-extract</loc>
<changefreq>weekly</changefreq>
<priority>0.7</priority>
</url>
<url>
<loc>http://192.168.2.200:3001/products/algae-extract/test004</loc>
<changefreq>weekly</changefreq>
<priority>0.7</priority>
</url>
<url>
<loc>http://192.168.2.200:3001/products/fruit-powders/organic-organic-powder-extract-supply-food-grade-freeze-dried-pomegranate-extract-powder</loc>
<changefreq>weekly</changefreq>
<priority>0.7</priority>
</url>
<url>
<loc>http://192.168.2.200:3001/products/algae-extract/sub-category</loc>
<changefreq>weekly</changefreq>
<priority>0.7</priority>
</url>
<url>
<loc>http://192.168.2.200:3001/products/fruit-powders/organic-freeze-dried-organic-pure-good-quality-organic-strawberry-powder-extract-natural-pigment-fruit-powder</loc>
<changefreq>weekly</changefreq>
<priority>0.7</priority>
</url>
<url>
<loc>http://192.168.2.200:3001/test1</loc>
<changefreq>weekly</changefreq>
<priority>0.7</priority>
</url>
<url>
<loc>http://192.168.2.200:3001/products/ratio-extract/organic-bladderwrack-extract</loc>
<changefreq>weekly</changefreq>
<priority>0.7</priority>
</url>
<url>
<loc>http://192.168.2.200:3001/products/fruit-powders/organic-supply-food-grade-powder-best-price-organic-raspberry-powder-quality-food-grade-powder-100-pure-fruit-powder</loc>
<changefreq>weekly</changefreq>
<priority>0.7</priority>
</url>
<url>
<loc>http://192.168.2.200:3001/products/vegetable-powders/organic-plant-extract-good-quality-beetroot-red-colour-powder-beetroot-juice-powder-beetroot-powder</loc>
<changefreq>weekly</changefreq>
<priority>0.7</priority>
</url>
<url>
<loc>http://192.168.2.200:3001/products/mushroom-extracts/organic-enoki-mushroom-powder</loc>
<changefreq>weekly</changefreq>
<priority>0.7</priority>
</url>
<url>
<loc>http://192.168.2.200:3001/products/fruit-powders/organic-100-pure-fruit-powder-instant-filled-powder-mango-powder-freeze-dried-extract-powder</loc>
<changefreq>weekly</changefreq>
<priority>0.7</priority>
</url>

View File

@ -9,7 +9,7 @@ const __dirname = path.dirname(__filename);
async function generateSitemap() {
const slugs = await getAllSlugs();
const siteUrl = process.env.SITE_URL || 'https://yourdomain.com';
const siteUrl = process.env.PUBLIC_SITE_URL || 'https://yourdomain.com';
const urls = slugs.map(slugArr => {
if (slugArr.length === 1 && slugArr[0] === '/') {
return '/';