Repository: notionnext-org/NotionNext (2026-07-28T13:19:40Z)

Issue:
Gallery 中「显示页面图标」及「属性是否可见 → Title」配置未生效
> 若为「如何使用 / 部署咨询」而非可复现缺陷，请改用 [Discussions · 使用问答](https://github.com/notionnext-org/NotionNext/discussions/new/choose)，Issue 仅用于可跟踪的 Bug。

---

<!--
  !!! 重要 !!!
  请遵守这个模板的格式填写，否则你的Issue将被关闭
-->

**描述bug**

首先感谢作者以及各位维护者一直以来对项目的维护与更新！
这是 #4293 修复后的回归测试结果。
由于我没有权限重新打开原 Issue，所以单独提交一个新的 Issue 继续反馈。
我更新到最新 main 后重新部署进行了测试，目前这个问题似乎仍然存在。
另外，在继续测试过程中，我发现了一个新的现象，感觉可能与这个问题有关。
我分别测试了下面两种配置：

情况一
* 显示页面图标：关闭
* 属性是否可见：Title 设置为不可见
Notion 中显示符合配置，但网站端仍然显示页面图标和 Title。
<img width="8112" height="1766" alt="Image" src="https://github.com/user-attachments/assets/1453972c-105d-430f-8252-3d95bf6119ea" />

情况二
* 显示页面图标：关闭
* 属性是否可见：Title 设置为可见
Notion 中显示同样符合配置，但网站端依然显示页面图标。
<img width="8112" height="1863" alt="Image" src="https://github.com/user-attachments/assets/e92ffe78-5a04-4523-affa-4d27a60f937c" />

我已经更新到最新 main 并重新部署，多次刷新页面测试，结果一致。
不确定这两个现象是否属于同一个问题，所以一起反馈，希望对定位有所帮助。

**期望的正常结果**
Gallery 应与 Notion 配置保持一致。
* 当关闭 显示页面图标 时，网站端不再显示页面图标；
* 当 属性是否可见 中将 Title 设置为不可见时，网站端不显示 Title。

**复现步骤**
1. 更新到最新 main 并重新部署；
2. 打开一个 Gallery 页面；
3. 测试以下两种配置：
    * 显示页面图标：关闭；Title：不可见；
    * 显示页面图标：关闭；Title：可见；
4. 刷新页面查看网站端显示结果。

**环境**

- 【必填】NotionNext版本 [例如. 4.10.8]
- 【必填】主题 [hexo]
- 【必填】部署方案 [vercel]
- 【可选】操作系统: [iOS, Android, windows]
- 【可选】浏览器 [chrome, safari, firefox]

**补充说明**
【可选】与问题相关的其它说明


Discussion:
已提交修复 PR：#4338

这次按实际 Gallery 数据补齐了两处兼容：关闭页面图标时 `show_page_icon` 被省略的情况，以及 `gallery_properties` 中 Title 的可见性。已覆盖 Title 隐藏/显示、图标显式开启和旧数据回退，并完成全量测试与浏览器样式验收。欢迎在预览可用后按原来的两种配置复测。



Patch:
diff --git a/patches/react-notion-x+7.10.0.patch b/patches/react-notion-x+7.10.0.patch
index 395453e427e..2e37deccfc7 100644
--- a/patches/react-notion-x+7.10.0.patch
+++ b/patches/react-notion-x+7.10.0.patch
@@ -1,15 +1,31 @@
 diff --git a/node_modules/react-notion-x/build/third-party/collection.js b/node_modules/react-notion-x/build/third-party/collection.js
-index 97e229d..64344de 100644
+index 97e229d..9d2e9f3 100644
 --- a/node_modules/react-notion-x/build/third-party/collection.js
 +++ b/node_modules/react-notion-x/build/third-party/collection.js
-@@ -5877,7 +5877,10 @@ function Gallery({
+@@ -5870,14 +5870,26 @@ function Gallery({
+     gallery_cover = { type: "none" },
+     gallery_cover_size = "medium",
+     gallery_cover_aspect = "cover",
++    gallery_properties,
++    gallery_title_visible,
++    show_page_icon,
+     inline_collection_first_load_limit
+   } = collectionView.format || {};
++  const titleProperty = gallery_properties == null ? void 0 : gallery_properties.find(
++    (property) => property.property === "title"
++  );
++  const shouldHidePageIcons = show_page_icon === false || show_page_icon == null && gallery_title_visible == null;
++  const shouldHideTitle = titleProperty ? titleProperty.visible === false : gallery_title_visible === false;
+   const [isExpanded, setIsExpanded] = React19.useState(false);
+   const loadLimit = inline_collection_first_load_limit == null ? void 0 : inline_collection_first_load_limit.limit;
    const shouldLimit = typeof loadLimit === "number";
    const showLoadMore = shouldLimit && !isExpanded && ((blockIds == null ? void 0 : blockIds.length) || 0) > loadLimit;
    const visibleBlockIds = showLoadMore ? blockIds == null ? void 0 : blockIds.slice(0, loadLimit) : blockIds;
 -  return /* @__PURE__ */ jsxs17("div", { className: "notion-gallery", children: [
 +  return /* @__PURE__ */ jsxs17("div", { className: cs(
 +    "notion-gallery",
-+    collectionView.format && collectionView.format.show_page_icon === false && "notion-gallery-hide-page-icons"
++    shouldHidePageIcons && "notion-gallery-hide-page-icons",
++    shouldHideTitle && "notion-gallery-hide-titles"
 +  ), children: [
      /* @__PURE__ */ jsx54("div", { className: "notion-gallery-view", children: /* @__PURE__ */ jsx54(
        "div",
diff --git a/styles/notion.css b/styles/notion.css
index 1476efe4c3c..675cb0c71c8 100644
--- a/styles/notion.css
+++ b/styles/notion.css
@@ -2203,6 +2203,13 @@ figure.notion-asset-wrapper.notion-asset-wrapper-video > div {
   display: none;
 }
 
+/* Respect the Gallery title property's visibility setting. */
+.notion-gallery-hide-titles
+  .notion-collection-card-body
+  > .notion-collection-card-property:first-child {
+  display: none;
+}
+
 /* Dark mode: database property tags (select / multi_select) text readability */
 html.dark .notion-property-select-item,
 html.dark .notion-property-status-item,


Test patch:
diff --git a/__tests__/components/NotionCollectionGallery.test.js b/__tests__/components/NotionCollectionGallery.test.js
index e5275d2df2b..98644a8bd02 100644
--- a/__tests__/components/NotionCollectionGallery.test.js
+++ b/__tests__/components/NotionCollectionGallery.test.js
@@ -5,7 +5,11 @@ const renderGalleryScript = `
   const { renderToStaticMarkup } = await import('react-dom/server')
   const { NotionRenderer } = await import('react-notion-x')
   const { Collection } = await import('react-notion-x/build/third-party/collection')
-  const createRecordMap = showPageIcon => ({
+  const createRecordMap = ({
+    showPageIcon,
+    titleVisible,
+    legacyTitleVisible
+  }) => ({
     block: {
       collection_view: {
         value: { id: 'collection_view', type: 'collection_view',
@@ -28,11 +32,17 @@ const renderGalleryScript = `
         value: { id: 'gallery_view', type: 'gallery',
           format: {
             collection_pointer: { id: 'collection' },
-            show_page_icon: showPageIcon,
+            ...(showPageIcon === undefined ? {} : { show_page_icon: showPageIcon }),
+            ...(legacyTitleVisible === undefined
+              ? {}
+              : { gallery_title_visible: legacyTitleVisible }),
             gallery_cover: { type: 'none' },
             gallery_cover_size: 'medium',
             gallery_cover_aspect: 'cover',
-            gallery_properties: []
+            gallery_properties:
+              titleVisible === undefined
+                ? []
+                : [{ property: 'title', visible: titleVisible }]
           } }
       }
     },
@@ -43,20 +53,22 @@ const renderGalleryScript = `
     },
     signed_urls: {}
   })
-  const renderGallery = showPageIcon =>
+  const renderGallery = options =>
     renderToStaticMarkup(
       React.createElement(NotionRenderer, {
-        recordMap: createRecordMap(showPageIcon),
+        recordMap: createRecordMap(options),
         components: { Collection }
       })
     )
   process.stdout.write(JSON.stringify({
-    hidden: renderGallery(false),
-    visible: renderGallery(true)
+    hidden: renderGallery({ titleVisible: false }),
+    titleVisible: renderGallery({ titleVisible: true }),
+    enabled: renderGallery({ showPageIcon: true, titleVisible: true }),
+    legacy: renderGallery({ legacyTitleVisible: true })
   }))
 `
 
-describe('Notion Gallery page icon setting', () => {
+describe('Notion Gallery visibility settings', () => {
   const result = JSON.parse(
     execFileSync(process.execPath, [
       '--input-type=module',
@@ -65,14 +77,27 @@ describe('Notion Gallery page icon setting', () => {
     ])
   )
 
-  it('adds the page-icon hiding class when Notion disables icons', () => {
+  it('hides omitted page icons and an explicitly hidden title', () => {
     expect(result.hidden).toContain(
+      'notion-gallery notion-gallery-hide-page-icons notion-gallery-hide-titles'
+    )
+  })
+
+  it('keeps a visible title while the omitted page-icon setting stays hidden', () => {
+    expect(result.titleVisible).toContain(
       'notion-gallery notion-gallery-hide-page-icons'
     )
+    expect(result.titleVisible).not.toContain('notion-gallery-hide-titles')
+  })
+
+  it('keeps page icons visible when Notion explicitly enables them', () => {
+    expect(result.enabled).toContain('class="notion-gallery"')
+    expect(result.enabled).not.toContain('notion-gallery-hide-page-icons')
+    expect(result.enabled).not.toContain('notion-gallery-hide-titles')
   })
 
-  it('keeps page icons visible when Notion enables icons', () => {
-    expect(result.visible).toContain('class="notion-gallery"')
-    expect(result.visible).not.toContain('notion-gallery-hide-page-icons')
+  it('preserves legacy Gallery data without the page-icon setting', () => {
+    expect(result.legacy).toContain('class="notion-gallery"')
+    expect(result.legacy).not.toContain('notion-gallery-hide-page-icons')
   })
 })