在Blogger中添加子菜单(pageListJSON)

时间:2017-07-29 08:09:22

标签: html json blogger

我想在我的博客中添加子菜单。我希望我的菜单是这样的(手动测试和自动化测试成为测试的子菜单)

  • 测试
    • 手动测试
    • 自动化测试

互联网上有很多教程。但是,他们仍在使用旧的博客设计,他们使用<ul><li>语法。在新的博客中(我不知道它何时开始),博主使用JSON进行页面列表管理,而不是<ul><li>

以下是我博客的pageListJson

<b:widget id='PageList1' locked='false' title='Pages' type='PageList'>
<b:widget-settings>
  <b:widget-setting name='pageListJson'>
    <![CDATA[{'91385535799150449': {'href': 'https://belajarbersama-arwan.blogspot.com/p/belajar-software-testing.html', 
            'title': 'Software Testing', 
            'position': 0}, 
    '4514379653067780013': {'href': 'https://belajarbersama-arwan.blogspot.com/p/manual-testing.html', 
            'title': 'Manual Testing', 
            'position': 1}, 
    '5318229156935072720': {'href': 'https://belajarbersama-arwan.blogspot.com/p/automated-testing.html', 
            'title': 'Automated Testing', 
            'position': 2}}]]>
    </b:widget-setting>
  <b:widget-setting name='homeTitle'>Home</b:widget-setting>
</b:widget-settings>

使用此JSON,菜单显示如下:

  • 测试
  • 手动测试
  • 自动化测试

我尝试将JSON修改为像这样

{'91385535799150449': 
    {'href': 'https://belajarbersama-arwan.blogspot.com/p/belajar-software-testing.html', 
    'title': 'Software Testing', 
    'position': 0, 
    '4514379653067780013': {'href': 'https://belajarbersama-arwan.blogspot.com/p/manual-testing.html', 
            'title': 'Manual Testing', 
            'position': 1}, 
    '5318229156935072720': {'href': 'https://belajarbersama-arwan.blogspot.com/p/automated-testing.html', 
            'title': 'Automated Testing', 
            'position': 2}}}

但是,只显示一个菜单,即软件测试

任何人都可以帮助我如何修改JSON,以便获得我想要的菜单结构?

感谢您的帮助

1 个答案:

答案 0 :(得分:1)

PageList小部件没有子菜单,json脚本仅用于设置目的,如标题,网址和位置,不用于添加内容。 如果要为每个列表创建子菜单,可以使用ul和li手动添加。