Instant Article Builder - 如何 select 两个 areas/elements 与文章的内容?

Instant Article Builder - How to select two areas/elements with content for the article?

我的页面在单独的元素中包含文章摘要和内容,我需要在即时文章中显示两者,但不会更改页面的 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>

您可以将 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":{...}
            }
        }

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