我想自动将Homepage和Post页面的唯一类名称添加到
标签。示例:
在首页上显示dataNames[0] = "Type"
dataNames[1] = "GameObjectsCount" //Added a s. Now have 16 chars
dataValues[0] = "Scene"
dataValues[1] = "5"
在标签“ ONE”上显示<body class='homepage-page'>
在标签“两个”上显示<body class='post-page label-one'>
答案 0 :(得分:0)
您可以使用b:class
标记将类添加到父元素。
不是{:{1}}之后的b:class标记
<body>
注意:<body>
<b:class cond='data:view.isHomepage' name='homepage-page'/> On homepage
<b:class cond='data:view.isSingleItem and (data:post.labels any (l => l.name == "One"))' name='One'/> On posts pages and label "One"
仅在博客窗口小部件data:post.labels
内有效
答案 1 :(得分:0)
<body>
<b:class cond='data:view.isHomepage' name='blog-view-home'/>
<b:class cond='data:view.isPost' name='blog-view-item'/>
<b:class cond='data:view.isPage' name='blog-view-static'/>
<b:class cond='data:view.search.label' name='blog-view-search-label'/>
<b:class cond='data:view.search.query' name='blog-view-search-query'/>
<b:class cond='data:view.search and !data:view.search.label and !data:view.search.query' name='blog-view-search-default'/>
<b:class cond='data:view.isArchive' name='blog-view-archive'/>
<b:class cond='data:view.isError' name='blog-view-error'/>
<b:class cond='data:view.isPreview' name='blog-view-preview'/>
答案 2 :(得分:0)
<body>
<b:attr name='class'
value='multiitem'
cond='data:view.isMultipleItems == "true"'/>
<b:attr name='class'
value='homepage'
cond='data:view.isHomepage == "true"'/>
<b:attr name='class'
value='singleitem'
cond='data:view.isSingleItem == "true"'/>
<b:attr name='class'
value='static'
cond='data:view.isStatic == "true"'/>
<b:attr name='class'
value='archive'
cond='data:view.isArchive == "true"'/>
<b:attr name='class'
value='error'
cond='data:view.isError == "true"'/>
<b:attr name='class'
value='post'
cond='data:view.isPost == "true"'/>
<b:attr name='class'
value='page'
cond='data:view.isPage == "true"'/>