sitemap,robots支持NOTION_CONFIG

This commit is contained in:
tangly1024.com
2024-05-10 18:46:31 +08:00
parent 5e9e639b71
commit 9ff763ece4
4 changed files with 14 additions and 15 deletions

View File

@@ -1,18 +1,18 @@
import fs from 'fs'
import BLOG from '@/blog.config'
import { siteConfig } from './config'
export async function generateRobotsTxt() {
export async function generateRobotsTxt(NOTION_CONFIG) {
const LINK = siteConfig('LINK', '', NOTION_CONFIG)
const content = `
# *
User-agent: *
Allow: /
# Host
Host: ${BLOG.LINK}
Host: ${LINK}
# Sitemaps
Sitemap: ${BLOG.LINK}/sitemap.xml
Sitemap: ${LINK}/sitemap.xml
`
try {

View File

@@ -1,4 +1,3 @@
import BLOG from '@/blog.config'
import NotionPage from '@/components/NotionPage'
import { getPostBlocks } from '@/lib/db/getSiteData'
import { Feed } from 'feed'
@@ -27,22 +26,22 @@ const createFeedContent = async post => {
}
export async function generateRss(NOTION_CONFIG, posts) {
const link = siteConfig('LINK', BLOG.LINK, NOTION_CONFIG)
const author = siteConfig('AUTHOR', BLOG.AUTHOR, NOTION_CONFIG)
const lang = siteConfig('LANG', BLOG.LANG, NOTION_CONFIG)
const subPath = siteConfig('SUB_PATH', BLOG.SUB_PATH, NOTION_CONFIG)
const link = siteConfig('LINK', '', NOTION_CONFIG)
const author = siteConfig('AUTHOR', '', NOTION_CONFIG)
const lang = siteConfig('LANG', '', NOTION_CONFIG)
const subPath = siteConfig('SUB_PATH', '', NOTION_CONFIG)
const year = new Date().getFullYear()
const feed = new Feed({
title: BLOG.TITLE,
description: BLOG.DESCRIPTION,
title: siteConfig('TITLE', '', NOTION_CONFIG),
description: siteConfig('DESCRIPTION', '', NOTION_CONFIG),
link: `${link}/${subPath}`,
language: lang,
favicon: `${link}/favicon.png`,
copyright: `All rights reserved ${year}, ${author}`,
author: {
name: author,
email: BLOG.CONTACT_EMAIL,
email: siteConfig('CONTACT_EMAIL', '', NOTION_CONFIG),
link: link
}
})