mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-14 07:26:52 +00:00
collection-cover
This commit is contained in:
@@ -129,7 +129,7 @@ function getBlogInfo({ collection, block }) {
|
||||
const title = collection?.name?.[0][0] || BLOG.TITLE
|
||||
const description = collection?.description ? Object.assign(collection).description[0][0] : BLOG.DESCRIPTION
|
||||
const pageCover = collection?.cover ? (mapImgUrl(collection?.cover, block[idToUuid(BLOG.NOTION_PAGE_ID)]?.value)) : BLOG.HOME_BANNER_IMAGE
|
||||
let icon = collection?.icon ? (mapImgUrl(collection?.icon, collection)) : BLOG.AVATAR
|
||||
let icon = collection?.icon ? (mapImgUrl(collection?.icon, collection, 'collection')) : BLOG.AVATAR
|
||||
// 站点图标不能是emoji情
|
||||
const emojiPattern = /\uD83C[\uDF00-\uDFFF]|\uD83D[\uDC00-\uDE4F]/g
|
||||
if (emojiPattern.test(icon)) {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* @param {*} value
|
||||
* @returns
|
||||
*/
|
||||
const mapImgUrl = (img, block) => {
|
||||
const mapImgUrl = (img, block, type = 'block') => {
|
||||
let ret = null
|
||||
if (!img) {
|
||||
return ret
|
||||
@@ -19,7 +19,7 @@ const mapImgUrl = (img, block) => {
|
||||
|
||||
// notion永久图床地址
|
||||
if (!ret && img.indexOf('secure.notion-static.com') > 0) {
|
||||
ret = 'https://www.notion.so/image/' + encodeURIComponent(img) + '?table=block&id=' + block.id
|
||||
ret = 'https://www.notion.so/image/' + encodeURIComponent(img) + '?table=' + type + '&id=' + block.id
|
||||
}
|
||||
|
||||
// 剩余的是第三方图片url或emoji
|
||||
|
||||
Reference in New Issue
Block a user