隐藏主题的组件和部分布局

默认情况下,所有组件和部分布局都可供站点开发人员使用。有时,您可能希望隐藏某个组件或部分布局,以便在使用特定布局时该组件或部分布局不可用。例如,如果您希望提升不使用任何按钮组件或滑块部分布局的一致外观,则可以通过编辑主题的 components.json 文件来在主题中隐藏这些组件或布局。

要隐藏主题中的组件和部分布局,请执行以下操作:

  1. Oracle Content Management 中,单击左侧导航菜单中的开发人员
  2. 在“开发人员”页上,单击查看所有主题
  3. 在“主题”页上,选择要修改的主题,然后在右键单击菜单中单击打开,或单击操作栏中的 “打开”图标
  4. 选择 components.json 文件并单击下载
  5. 在文本编辑器中打开 components.json 文件。
  6. 添加用于指定组件类型和 ID 的对象,将属性 hidden 设置为等于 true
    例如,下面是用来隐藏按钮组件的示例条目:
    "type":"scs-button",
    "id":"scs-button",
    "hidden":true
    同样,下面是用来隐藏滑块部分布局的示例条目:
    "type":"scs-sectionlayout",
    "id":"scs-sl-slider",
    "hidden":true

    components.json 文件中用来隐藏按钮组件和滑块部分布局的完整条目如下所示:

    [
        {
            "name":"",
            "list":[
                {
                    "type":"scs-button",
                    "id":"scs-button",
                    "hidden":true
                },
                {
                    "type":"scs-sectionlayout",
                    "id":"scs-sl-slider",
                    "hidden":true
                }
            ]
        },
        {
            "name": "Starter",
            "list": [
                {
                    "type": "component",
                    "id": "StarterComponent",
                    "themed": true
                },
                {
                    "type": "component",
                    "id": "StarterFooter",
                    "themed": true
                }
            ]
        }
    ]
  7. 进行了所需更改后,将 components.json 文件作为新版本上载到主题。