Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

【随机封面】配置NEXT_PUBLIC_RANDOM_IMAGE_URL,设置一个随机图片地址,所有文章获取为同一张图片 #2927

Open
itq5 opened this issue Nov 5, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@itq5
Copy link

itq5 commented Nov 5, 2024

描述bug
【此项必填】在Notion上不配置文章封面,在环境变量或者CONFIG中配置NEXT_PUBLIC_RANDOM_IMAGE_URL,设置一个随机图片地址,所有文章获取为同一张图片。
image
image
我测试了所有主题,都有这个情况,在NotionNext/lib/notion/mapImage.js中

    // 图片url优化,确保每一篇文章的图片url唯一
    if (
      ret &&
      ret.length > 4 &&
      !ret.includes('https://www.notion.so/images/')
    ) {
      // 图片接口拼接唯一识别参数,防止请求的图片被缓,而导致随机结果相同
      const separator = ret.includes('?') ? '&' : '?'
      ret = `${ret.trim()}${separator}t=${block.id}`
    }
  }

并没有起到每个获取图片的接口地址?t=后随机,都是拿的一个同一个ID

期望的正常结果
【此项必填】
没有配置封面的文章采用随机地址,每个文章获取不同的封面

复现步骤
【此项必填】

环境

  • 【必填】NotionNext版本 4.7.7
  • 【必填】主题 HEO及所有主题
  • 【必填】部署方案 vercel
  • 【可选】操作系统: 所有
  • 【可选】浏览器 所有
    补充说明
    【可选】与问题相关的其它说明
@itq5 itq5 added the bug Something isn't working label Nov 5, 2024
@tangly1024 tangly1024 changed the title 在Notion上不配置文章封面,在环境变量或者CONFIG中配置NEXT_PUBLIC_RANDOM_IMAGE_URL,设置一个随机图片地址,所有文章获取为同一张图片 【随机封面】配置NEXT_PUBLIC_RANDOM_IMAGE_URL,设置一个随机图片地址,所有文章获取为同一张图片 Nov 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants