Instant Article Builder-如何为文章选择两个区域/元素?

时间:2019-03-03 15:16:56

标签: facebook facebook-instant-articles

我的页面在单独的元素中包含文章摘要和内容,我需要在即时文章中同时显示两者,但无需更改页面的HTML结构。

https://developers.facebook.com/docs/instant-articles/builder

<div class="summary-news">
    <div class="summary-content">
        <h3>Summary</h3>
        <ul>  
            <li> Item 1</li> 
            <li> Item 2</li>
            <li> ... </li>
        </ul>
    </div>
</div>

<div>
    <!-- Other content -->
</div>

<div class="text">
    <!-- Main content -->
</div>

1 个答案:

答案 0 :(得分:0)

您可以将GlobalRule更改为您的设置,以特定于此整页的任何包装标签。

让我们说您在结构周围有一个<body>标签:

<body>

<div class="summary-news">
<div class="summary-content">
    <h3>Summary</h3>
    <ul>  
        <li> Item 1</li> 
        <li> Item 2</li>
        <li> ... </li>
    </ul>
</div>
</div>

<div>
<!-- Other content -->
</div>

<div class="text">
<!-- Main content -->
</div>

</body>

然后,您只需要从article.body设置中更改GlobalRule属性即可获得此包装容器:

{
            "class":"GlobalRule",
            "selector":"html",
            "properties":{
                "article.title":{...},
                "author.url":{...},
                "author.name":{...},
                "author.role_contribution" : {...},
                "author.description" : {...},
                "article.canonical": {...},
                "article.publish": {...},
                "article.body":{
                    "selector":"body",   // Or whatever selector that grabs your container
                    "type":"element"
                },
                "image.url":{...}
            }
        }

这应该可以满足您的需要。