diff --git a/blog.config.js b/blog.config.js index abf2d46c..f19effce 100644 --- a/blog.config.js +++ b/blog.config.js @@ -145,7 +145,7 @@ const BLOG = { ALGOLIA_ADMIN_APP_KEY: process.env.ALGOLIA_ADMIN_APP_KEY || null, // 管理后台的KEY,不要暴露在代码中,在这里查看 https://dashboard.algolia.com/account/api-keys/ ALGOLIA_SEARCH_ONLY_APP_KEY: process.env.NEXT_PUBLIC_ALGOLIA_SEARCH_ONLY_APP_KEY || null, // 客户端搜索用的KEY ALGOLIA_INDEX: process.env.NEXT_PUBLIC_ALGOLIA_INDEX || null, // 在Algolia中创建一个index用作数据库 - ALGOLIA_RECREATE_DATA: process.env.ALGOLIA_RECREATE_DATA || process.env.npm_lifecycle_event === 'build', // 为true时重新构建索引数据; 默认在build时会构建 + // ALGOLIA_RECREATE_DATA: process.env.ALGOLIA_RECREATE_DATA || process.env.npm_lifecycle_event === 'build', // 为true时重新构建索引数据; 默认在build时会构建 PREVIEW_CATEGORY_COUNT: 16, // 首页最多展示的分类数量,0为不限制 PREVIEW_TAG_COUNT: 16, // 首页最多展示的标签数量,0为不限制 diff --git a/components/AlgoliaSearchModal.js b/components/AlgoliaSearchModal.js index 7725689a..53cd0fcf 100644 --- a/components/AlgoliaSearchModal.js +++ b/components/AlgoliaSearchModal.js @@ -156,8 +156,8 @@ function TagGroups(props) { return -
+ className={'cursor-pointer inline-block whitespace-nowrap'}> +
{tag.name}
{tag.count ? {tag.count} : <>}
diff --git a/components/CommonHead.js b/components/CommonHead.js index 32b71fad..24bfae69 100644 --- a/components/CommonHead.js +++ b/components/CommonHead.js @@ -58,7 +58,7 @@ const CommonHead = ({ meta, children }) => { <> diff --git a/lib/algolia.js b/lib/algolia.js index b7439438..da92b334 100644 --- a/lib/algolia.js +++ b/lib/algolia.js @@ -17,26 +17,88 @@ const generateAlgoliaSearch = async({ allPages, force = false }) => { /** * 上传数据 + * 根据上次修改文章日期和上次更新索引数据判断是否需要更新algolia索引 */ -const uploadDataToAlgolia = (post) => { +const uploadDataToAlgolia = async(post) => { // Connect and authenticate with your Algolia app const client = algoliasearch(BLOG.ALGOLIA_APP_ID, BLOG.ALGOLIA_ADMIN_APP_KEY) // Create a new index and add a record const index = client.initIndex(BLOG.ALGOLIA_INDEX) - const record = { - objectID: post.id, - title: post.title, - category: post.category, - tags: post.tags, - pageCover: post.pageCover, - slug: post.slug, - summary: post.summary, - content: getPageContentText(post, post.blockMap) + + if (!post) { + return } - index.saveObject(record).wait().then(r => { - console.log('Algolia索引', r, record) - }) + + // 检查是否有索引 + let existed + let needUpdateIndex = false + try { + existed = await index.getObject(post.id) + } catch (error) { + // 通常是不存在索引 + } + + if (!existed || !existed?.lastEditedDate || !existed?.lastIndexDate) { + needUpdateIndex = true + } else { + const lastEditedDate = new Date(existed.lastEditedDate) + const lastIndexDate = new Date(existed.lastIndexDate) + if (lastEditedDate.getTime() > lastIndexDate.getTime()) { + needUpdateIndex = true + } + } + + // 如果需要更新搜索 + if (needUpdateIndex) { + const record = { + objectID: post.id, + title: post.title, + category: post.category, + tags: post.tags, + pageCover: post.pageCover, + slug: post.slug, + summary: post.summary, + lastEditedDate: post.lastEditedDate, // 更新文章时间 + lastIndexDate: new Date(), // 更新索引时间 + content: truncate(getPageContentText(post, post.blockMap), 9000) // 索引9000个字节,因为api限制总请求内容上限1万个字节 + } + console.log('更新Algolia索引', record) + index.saveObject(record).wait().then(r => { + console.log('更新成功', r) + }).catch(err => { + console.log('algolia', err) + }) + } +} + +/** + * 限制内容字节数 + * @param {*} str + * @param {*} maxBytes + * @returns + */ +function truncate(str, maxBytes) { + let count = 0 + let result = '' + for (let i = 0; i < str.length; i++) { + const code = str.charCodeAt(i) + if (code <= 0x7f) { + count += 1 + } else if (code <= 0x7ff) { + count += 2 + } else if (code <= 0xffff) { + count += 3 + } else { + count += 4 + } + if (count <= maxBytes) { + result += str[i] + } else { + break + } + } + return result } export { uploadDataToAlgolia, generateAlgoliaSearch } diff --git a/lib/notion/getNotion.js b/lib/notion/getNotion.js index f73100c2..3da84ee8 100644 --- a/lib/notion/getNotion.js +++ b/lib/notion/getNotion.js @@ -25,7 +25,7 @@ export async function getNotion(pageId) { title: postInfo?.properties?.title?.[0], status: 'Published', createdTime: formatDate(new Date(postInfo.created_time).toString(), BLOG.LANG), - lastEditedTime: formatDate(new Date(postInfo?.last_edited_time).toString(), BLOG.LANG), + lastEditedDay: formatDate(new Date(postInfo?.last_edited_time).toString(), BLOG.LANG), fullWidth: false, page_cover: getPageCover(postInfo), date: { start_date: formatDate(new Date(postInfo?.last_edited_time).toString(), BLOG.LANG) }, diff --git a/lib/notion/getNotionData.js b/lib/notion/getNotionData.js index 393e3c63..d452eb5f 100644 --- a/lib/notion/getNotionData.js +++ b/lib/notion/getNotionData.js @@ -25,7 +25,8 @@ export async function getGlobalData({ from }) { // 从notion获取 - const db = deepClone(await getNotionPageData({ pageId, from })) + const data = await getNotionPageData({ pageId, from }) + const db = deepClone(data) // 不返回的敏感数据 delete db.block delete db.schema @@ -48,8 +49,8 @@ function getLatestPosts({ allPages, from, latestPostCount }) { const allPosts = allPages?.filter(page => page.type === 'Post' && page.status === 'Published') const latestPosts = Object.create(allPosts).sort((a, b) => { - const dateA = new Date(a?.lastEditedTime || a?.publishDate) - const dateB = new Date(b?.lastEditedTime || b?.publishDate) + const dateA = new Date(a?.lastEditedDay || a?.publishDate) + const dateB = new Date(b?.lastEditedDay || b?.publishDate) return dateB - dateA }) return latestPosts.slice(0, latestPostCount) @@ -217,7 +218,7 @@ const EmptyData = (pageId) => { const empty = { notice: null, siteInfo: getSiteInfo({}), - allPages: [{ id: 1, title: `无法获取Notion数据,请检查Notion_ID: \n 当前 ${pageId}`, summary: '访问文档获取帮助→ https://tangly1024.com/article/vercel-deploy-notion-next', status: 'Published', type: 'Post', slug: '13a171332816461db29d50e9f575b00d', date: { start_date: '2023-04-24', lastEditedTime: '2023-04-24', tagItems: [] } }], + allPages: [{ id: 1, title: `无法获取Notion数据,请检查Notion_ID: \n 当前 ${pageId}`, summary: '访问文档获取帮助→ https://tangly1024.com/article/vercel-deploy-notion-next', status: 'Published', type: 'Post', slug: '13a171332816461db29d50e9f575b00d', date: { start_date: '2023-04-24', lastEditedDay: '2023-04-24', tagItems: [] } }], allNavPages: [], collection: [], collectionQuery: {}, diff --git a/lib/notion/getPageProperties.js b/lib/notion/getPageProperties.js index dea5c2b1..b9bdbe4d 100644 --- a/lib/notion/getPageProperties.js +++ b/lib/notion/getPageProperties.js @@ -78,8 +78,9 @@ export default async function getPageProperties(id, block, schema, authToken, ta mapProperties(properties) properties.publishDate = new Date(properties?.date?.start_date || value.created_time).getTime() - properties.publishTime = formatDate(properties.publishDate, BLOG.LANG) - properties.lastEditedTime = formatDate(new Date(value?.last_edited_time), BLOG.LANG) + properties.publishDay = formatDate(properties.publishDate, BLOG.LANG) + properties.lastEditedDate = new Date(value?.last_edited_time) + properties.lastEditedDay = formatDate(new Date(value?.last_edited_time), BLOG.LANG) properties.fullWidth = value.format?.page_full_width ?? false properties.pageIcon = mapImgUrl(block[id].value?.format?.page_icon, block[id].value) ?? '' properties.pageCover = mapImgUrl(block[id].value?.format?.page_cover, block[id].value) ?? '' @@ -141,14 +142,14 @@ function generateCustomizeUrl(postProperties) { let fullPrefix = '' const allSlugPatterns = BLOG.POST_URL_PREFIX.split('/') allSlugPatterns.forEach((pattern, idx) => { - if (pattern === '%year%' && postProperties?.publishTime) { - const formatPostCreatedDate = new Date(postProperties?.publishTime) + if (pattern === '%year%' && postProperties?.publishDay) { + const formatPostCreatedDate = new Date(postProperties?.publishDay) fullPrefix += formatPostCreatedDate.getUTCFullYear() - } else if (pattern === '%month%' && postProperties?.publishTime) { - const formatPostCreatedDate = new Date(postProperties?.publishTime) + } else if (pattern === '%month%' && postProperties?.publishDay) { + const formatPostCreatedDate = new Date(postProperties?.publishDay) fullPrefix += String(formatPostCreatedDate.getUTCMonth() + 1).padStart(2, 0) - } else if (pattern === '%day%' && postProperties?.publishTime) { - const formatPostCreatedDate = new Date(postProperties?.publishTime) + } else if (pattern === '%day%' && postProperties?.publishDay) { + const formatPostCreatedDate = new Date(postProperties?.publishDay) fullPrefix += String(formatPostCreatedDate.getUTCDate()).padStart(2, 0) } else if (pattern === '%slug%') { fullPrefix += (postProperties.slug ?? postProperties.id) diff --git a/lib/rss.js b/lib/rss.js index d40b940b..fff81f7c 100644 --- a/lib/rss.js +++ b/lib/rss.js @@ -46,7 +46,7 @@ export async function generateRss(posts) { link: `${BLOG.LINK}/${post.slug}`, description: post.summary, content: await createFeedContent(post), - date: new Date(post?.publishTime) + date: new Date(post?.publishDay) }) } diff --git a/lib/sitemap.xml.js b/lib/sitemap.xml.js index 6c8bd040..c520c0ff 100644 --- a/lib/sitemap.xml.js +++ b/lib/sitemap.xml.js @@ -26,7 +26,7 @@ export async function generateSitemapXml({ allPages }) { const slugWithoutLeadingSlash = post?.slug?.startsWith('/') ? post?.slug?.slice(1) : post.slug urls.push({ loc: `${BLOG.LINK}/${slugWithoutLeadingSlash}`, - lastmod: new Date(post?.publishTime).toISOString().split('T')[0], + lastmod: new Date(post?.publishDay).toISOString().split('T')[0], changefreq: 'daily' }) }) diff --git a/lib/utils.js b/lib/utils.js index d5ba09b5..e13b192f 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -117,7 +117,13 @@ export function deepClone(obj) { if (obj && typeof obj === 'object') { for (const key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { - newObj[key] = (obj && typeof obj[key] === 'object') ? deepClone(obj[key]) : obj[key] + if (obj[key] instanceof Date) { // 判断属性值是否为 Date 对象 + newObj[key] = new Date(obj[key].getTime()).toISOString() // 直接拷贝引用 + } else if (obj[key] && typeof obj[key] === 'object') { + newObj[key] = deepClone(obj[key]) + } else { + newObj[key] = obj[key] + } } } } diff --git a/pages/[prefix]/[slug].js b/pages/[prefix]/[slug].js index a3e9983a..7b99ddd8 100644 --- a/pages/[prefix]/[slug].js +++ b/pages/[prefix]/[slug].js @@ -64,8 +64,8 @@ export async function getStaticProps({ params: { prefix, slug } }) { if (!props?.posts?.blockMap) { props.post.blockMap = await getPostBlocks(props.post.id, from) } - // 生成全文索引 - if (BLOG.ALGOLIA_APP_ID && JSON.parse(BLOG.ALGOLIA_RECREATE_DATA) && process.env.npm_lifecycle_event === 'build') { + // 生成全文索引 && JSON.parse(BLOG.ALGOLIA_RECREATE_DATA) + if (BLOG.ALGOLIA_APP_ID) { uploadDataToAlgolia(props?.post) } diff --git a/pages/[prefix]/index.js b/pages/[prefix]/index.js index 14c26bf4..3db22414 100644 --- a/pages/[prefix]/index.js +++ b/pages/[prefix]/index.js @@ -95,8 +95,10 @@ export async function getStaticPaths() { } } -export async function getStaticProps({ params: { prefix } }) { - let fullSlug = prefix +export async function getStaticProps(p) { + const { params } = p + console.log('getStaticProps', p) + let fullSlug = params.prefix if (JSON.parse(BLOG.PSEUDO_STATIC)) { if (!fullSlug.endsWith('.html')) { fullSlug += '.html' @@ -111,7 +113,7 @@ export async function getStaticProps({ params: { prefix } }) { // 处理非列表内文章的内信息 if (!props?.post) { - const pageId = prefix.slice(-1)[0] + const pageId = params.PSEUDO_STATICprefix.slice(-1)[0] if (pageId.length >= 32) { const post = await getNotion(pageId) props.post = post @@ -129,8 +131,8 @@ export async function getStaticProps({ params: { prefix } }) { props.post.blockMap = await getPostBlocks(props.post.id, from) } - // 生成全文索引 - if (BLOG.ALGOLIA_APP_ID && JSON.parse(BLOG.ALGOLIA_RECREATE_DATA) && process.env.npm_lifecycle_event === 'build') { + // 生成全文索引 && process.env.npm_lifecycle_event === 'build' && JSON.parse(BLOG.ALGOLIA_RECREATE_DATA) + if (BLOG.ALGOLIA_APP_ID) { uploadDataToAlgolia(props?.post) } diff --git a/pages/index.js b/pages/index.js index 404fab19..86d9de24 100644 --- a/pages/index.js +++ b/pages/index.js @@ -6,7 +6,6 @@ import { generateRobotsTxt } from '@/lib/robots.txt' import { useRouter } from 'next/router' import { getLayoutByTheme } from '@/themes/theme' -import { generateAlgoliaSearch } from '@/lib/algolia' /** * 首页布局 @@ -64,9 +63,6 @@ export async function getStaticProps() { } // 生成全文索引 - 仅在 yarn build 时执行 && process.env.npm_lifecycle_event === 'build' - if (BLOG.ALGOLIA_APP_ID && JSON.parse(BLOG.ALGOLIA_RECREATE_DATA)) { - generateAlgoliaSearch({ allPages: props.allPages }) - } delete props.allPages diff --git a/pages/sitemap.xml.js b/pages/sitemap.xml.js index 58011385..58c9a846 100644 --- a/pages/sitemap.xml.js +++ b/pages/sitemap.xml.js @@ -42,7 +42,7 @@ export const getServerSideProps = async (ctx) => { const slugWithoutLeadingSlash = post?.slug.startsWith('/') ? post?.slug?.slice(1) : post.slug return { loc: `${BLOG.LINK}/${slugWithoutLeadingSlash}`, - lastmod: new Date(post?.publishTime).toISOString().split('T')[0], + lastmod: new Date(post?.publishDay).toISOString().split('T')[0], changefreq: 'daily', priority: '0.7' } diff --git a/themes/example/components/ArticleInfo.js b/themes/example/components/ArticleInfo.js index cd29e978..825fc774 100644 --- a/themes/example/components/ArticleInfo.js +++ b/themes/example/components/ArticleInfo.js @@ -29,12 +29,12 @@ export const ArticleInfo = (props) => { passHref className="pl-1 mr-2 cursor-pointer hover:text-gray-700 dark:hover:text-gray-200 border-b dark:border-gray-500 border-dashed"> - {post?.publishTime} + {post?.publishDay} | - {locale.COMMON.LAST_EDITED_TIME}: {post?.lastEditedTime} + {locale.COMMON.LAST_EDITED_TIME}: {post?.lastEditedDay} | diff --git a/themes/example/components/BlogListGroupByDate.js b/themes/example/components/BlogListGroupByDate.js index 7759eaca..ac5f9cbd 100644 --- a/themes/example/components/BlogListGroupByDate.js +++ b/themes/example/components/BlogListGroupByDate.js @@ -19,9 +19,9 @@ export default function BlogListGroupByDate({ archiveTitle, archivePosts }) { key={post.id} className="border-l-2 p-1 text-xs md:text-base items-center hover:scale-x-105 hover:border-gray-500 dark:hover:border-gray-300 dark:border-gray-400 transform duration-500" > -
+
- {post?.publishTime} + {post?.publishDay} {' '}   diff --git a/themes/fukasawa/components/ArticleDetail.js b/themes/fukasawa/components/ArticleDetail.js index 2e2cce59..9e47a925 100644 --- a/themes/fukasawa/components/ArticleDetail.js +++ b/themes/fukasawa/components/ArticleDetail.js @@ -59,12 +59,12 @@ export default function ArticleDetail(props) { passHref className="pl-1 mr-2 cursor-pointer hover:text-gray-700 dark:hover:text-gray-200 border-b dark:border-gray-500 border-dashed"> - {post?.publishTime} + {post?.publishDay} | - {locale.COMMON.LAST_EDITED_TIME}: {post.lastEditedTime} + {locale.COMMON.LAST_EDITED_TIME}: {post.lastEditedDay} )} diff --git a/themes/fukasawa/components/BlogPostArchive.js b/themes/fukasawa/components/BlogPostArchive.js index ba68f8cf..08557ae3 100644 --- a/themes/fukasawa/components/BlogPostArchive.js +++ b/themes/fukasawa/components/BlogPostArchive.js @@ -26,7 +26,7 @@ const BlogArchiveItem = ({ posts = [], archiveTitle }) => { key={post.id} className="border-l-2 p-1 text-xs md:text-base items-center hover:scale-x-105 hover:border-gray-500 dark:hover:border-gray-300 dark:border-gray-400 transform duration-500" > -
+
{post.date?.start_date}{' '}   +
{post.title}
-
{post.lastEditedTime}
+
{post.lastEditedDay}
diff --git a/themes/heo/components/PostHeader.js b/themes/heo/components/PostHeader.js index 5a707477..c7f47b5c 100644 --- a/themes/heo/components/PostHeader.js +++ b/themes/heo/components/PostHeader.js @@ -79,13 +79,13 @@ export default function PostHeader({ post, siteInfo }) { href={`/archive#${formatDateFmt(post?.publishDate, 'yyyy-MM')}`} passHref className="pl-1 mr-2 cursor-pointer hover:underline"> - {post?.publishTime} + {post?.publishDay} )}
- {post.lastEditedTime} + {post.lastEditedDay}
diff --git a/themes/hexo/components/BlogPostArchive.js b/themes/hexo/components/BlogPostArchive.js index 08feff4c..ea3c6cd2 100644 --- a/themes/hexo/components/BlogPostArchive.js +++ b/themes/hexo/components/BlogPostArchive.js @@ -26,7 +26,7 @@ const BlogPostArchive = ({ posts = [], archiveTitle }) => { key={post.id} className="border-l-2 p-1 text-xs md:text-base items-center hover:scale-x-105 hover:border-indigo-500 dark:hover:border-indigo-300 dark:border-indigo-400 transform duration-500" > -
+
{post.date?.start_date}{' '}   - {post?.publishTime || post.lastEditedTime} + {post?.publishDay || post.lastEditedDay} diff --git a/themes/hexo/components/LatestPostsGroup.js b/themes/hexo/components/LatestPostsGroup.js index d315367a..bc3002dd 100644 --- a/themes/hexo/components/LatestPostsGroup.js +++ b/themes/hexo/components/LatestPostsGroup.js @@ -52,7 +52,7 @@ const LatestPostsGroup = ({ latestPosts, siteInfo }) => { >
{post.title}
-
{post.lastEditedTime}
+
{post.lastEditedDay}
diff --git a/themes/hexo/components/PostHeader.js b/themes/hexo/components/PostHeader.js index 21eec51a..acafaf0f 100644 --- a/themes/hexo/components/PostHeader.js +++ b/themes/hexo/components/PostHeader.js @@ -47,13 +47,13 @@ export default function PostHeader({ post, siteInfo }) { passHref className="pl-1 mr-2 cursor-pointer hover:underline"> - {locale.COMMON.POST_TIME}: {post?.publishTime} + {locale.COMMON.POST_TIME}: {post?.publishDay} )}
- {locale.COMMON.LAST_EDITED_TIME}: {post.lastEditedTime} + {locale.COMMON.LAST_EDITED_TIME}: {post.lastEditedDay}
diff --git a/themes/matery/components/ArticleInfo.js b/themes/matery/components/ArticleInfo.js index 293eb3e7..d8507686 100644 --- a/themes/matery/components/ArticleInfo.js +++ b/themes/matery/components/ArticleInfo.js @@ -28,11 +28,11 @@ export const ArticleInfo = (props) => { passHref className="cursor-pointer whitespace-nowrap"> - {locale.COMMON.POST_TIME}: {post?.publishTime} + {locale.COMMON.POST_TIME}: {post?.publishDay} - {locale.COMMON.LAST_EDITED_TIME}: {post.lastEditedTime} + {locale.COMMON.LAST_EDITED_TIME}: {post.lastEditedDay} diff --git a/themes/matery/components/BlogPostArchive.js b/themes/matery/components/BlogPostArchive.js index 08feff4c..ea3c6cd2 100644 --- a/themes/matery/components/BlogPostArchive.js +++ b/themes/matery/components/BlogPostArchive.js @@ -26,7 +26,7 @@ const BlogPostArchive = ({ posts = [], archiveTitle }) => { key={post.id} className="border-l-2 p-1 text-xs md:text-base items-center hover:scale-x-105 hover:border-indigo-500 dark:hover:border-indigo-300 dark:border-indigo-400 transform duration-500" > -
+
{post.date?.start_date}{' '}   { className="font-light hover:underline cursor-pointer text-sm leading-4 mr-3"> - {post.date?.start_date || post.lastEditedTime} + {post.date?.start_date || post.lastEditedDay} diff --git a/themes/medium/components/ArticleInfo.js b/themes/medium/components/ArticleInfo.js index 3d4abce5..0ecff45e 100644 --- a/themes/medium/components/ArticleInfo.js +++ b/themes/medium/components/ArticleInfo.js @@ -17,9 +17,9 @@ export default function ArticleInfo(props) { {/* meta */}
- {post?.publishTime} + {post?.publishDay} | - {post?.lastEditedTime} + {post?.lastEditedDay}
diff --git a/themes/medium/components/BlogArchiveItem.js b/themes/medium/components/BlogArchiveItem.js index 52b2fefb..8e9693dc 100644 --- a/themes/medium/components/BlogArchiveItem.js +++ b/themes/medium/components/BlogArchiveItem.js @@ -17,7 +17,7 @@ export default function BlogArchiveItem({ archiveTitle, archivePosts }) {
  • -
    +
    {post.date?.start_date} {' '} diff --git a/themes/next/components/ArticleDetail.js b/themes/next/components/ArticleDetail.js index a2d6fc48..a4f575ec 100644 --- a/themes/next/components/ArticleDetail.js +++ b/themes/next/components/ArticleDetail.js @@ -59,10 +59,10 @@ export default function ArticleDetail(props) { passHref legacyBehavior>
    - {post?.publishTime} + {post?.publishDay}
    - | {post.lastEditedTime} + | {post.lastEditedDay}
    diff --git a/themes/next/components/BlogPostArchive.js b/themes/next/components/BlogPostArchive.js index a6c0e796..b1f22296 100644 --- a/themes/next/components/BlogPostArchive.js +++ b/themes/next/components/BlogPostArchive.js @@ -26,7 +26,7 @@ const BlogPostArchive = ({ posts = [], archiveTitle }) => { key={post.id} className="border-l-2 p-1 text-xs md:text-base items-center hover:scale-x-105 hover:border-gray-500 dark:hover:border-gray-300 dark:border-gray-400 transform duration-500" > -
    +
    {post.date?.start_date}{' '}   {  / 
    - {post?.publishTime} + {post?.publishDay}
    {post?.tags && (
    diff --git a/themes/nobelium/components/BlogArchiveItem.js b/themes/nobelium/components/BlogArchiveItem.js index 3b16fc3b..b8184f45 100644 --- a/themes/nobelium/components/BlogArchiveItem.js +++ b/themes/nobelium/components/BlogArchiveItem.js @@ -19,7 +19,7 @@ export default function BlogArchiveItem({ archiveTitle, archivePosts }) { key={post.id} className="border-l-2 p-1 text-xs md:text-base items-center hover:scale-x-105 hover:border-gray-500 dark:hover:border-gray-300 dark:border-gray-400 transform duration-500" > -
    +
    {post.date?.start_date} {' '} diff --git a/themes/nobelium/components/BlogPost.js b/themes/nobelium/components/BlogPost.js index 91ad3bd4..b1080b35 100644 --- a/themes/nobelium/components/BlogPost.js +++ b/themes/nobelium/components/BlogPost.js @@ -12,7 +12,7 @@ const BlogPost = ({ post }) => { {post.title}
    diff --git a/themes/plog/components/ArticleInfo.js b/themes/plog/components/ArticleInfo.js index 7cc873aa..0ecb4895 100644 --- a/themes/plog/components/ArticleInfo.js +++ b/themes/plog/components/ArticleInfo.js @@ -32,7 +32,7 @@ export const ArticleInfo = (props) => {  / 
    - {post?.publishTime} + {post?.publishDay}
    {post?.tags && (
    diff --git a/themes/plog/components/BlogArchiveItem.js b/themes/plog/components/BlogArchiveItem.js index 3b16fc3b..b8184f45 100644 --- a/themes/plog/components/BlogArchiveItem.js +++ b/themes/plog/components/BlogArchiveItem.js @@ -19,7 +19,7 @@ export default function BlogArchiveItem({ archiveTitle, archivePosts }) { key={post.id} className="border-l-2 p-1 text-xs md:text-base items-center hover:scale-x-105 hover:border-gray-500 dark:hover:border-gray-300 dark:border-gray-400 transform duration-500" > -
    +
    {post.date?.start_date} {' '} diff --git a/themes/simple/components/ArticleInfo.js b/themes/simple/components/ArticleInfo.js index 6f17b0df..30e1b5f4 100644 --- a/themes/simple/components/ArticleInfo.js +++ b/themes/simple/components/ArticleInfo.js @@ -20,7 +20,7 @@ export const ArticleInfo = (props) => { {post?.type !== 'Page' && (<>
    {BLOG.AUTHOR} - - {post?.publishTime} + - {post?.publishDay} {post?.category && - {post?.category}} {post?.tags && post?.tags?.length > 0 && post?.tags.map(t => / {t})}
    @@ -32,12 +32,12 @@ export const ArticleInfo = (props) => { href={`/archive#${formatDateFmt(post?.publishDate, 'yyyy-MM')}`} passHref className="pl-1 mr-2 cursor-pointer hover:text-gray-700 dark:hover:text-gray-200 border-b dark:border-gray-500 border-dashed"> - {post?.publishTime} + {post?.publishDay} | - {locale.COMMON.LAST_EDITED_TIME}: {post?.lastEditedTime} + {locale.COMMON.LAST_EDITED_TIME}: {post?.lastEditedDay} | diff --git a/themes/simple/components/BlogArchiveItem.js b/themes/simple/components/BlogArchiveItem.js index 3b16fc3b..b8184f45 100644 --- a/themes/simple/components/BlogArchiveItem.js +++ b/themes/simple/components/BlogArchiveItem.js @@ -19,7 +19,7 @@ export default function BlogArchiveItem({ archiveTitle, archivePosts }) { key={post.id} className="border-l-2 p-1 text-xs md:text-base items-center hover:scale-x-105 hover:border-gray-500 dark:hover:border-gray-300 dark:border-gray-400 transform duration-500" > -
    +
    {post.date?.start_date} {' '}