如何在Blogger中创建其他小部件

时间:2019-04-12 10:05:51

标签: blogger blogspot blogger-dynamic-views

我是Blogger模板制作和学习的新手。 根据Blogger和其他一些网站上的Google文档,我设法创建了以下模板。

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html>
<html b:version="2" expr:dir="data:blog.languageDirection" xmlns="http://www.w3.org/1999/xhtml"
    xmlns:b="http://www.google.com/2005/gml/b" xmlns:data="http://www.google.com/2005/gml/data"
    xmlns:expr="http://www.google.com/2005/gml/expr">
<b:skin>
    <![CDATA[]]>
</b:skin>

<head>
    <!-- Required meta tags -->
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
    <!-- Bootstrap CSS -->
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css"
        integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous" />
    <title>
        <data:blog.title />
    </title>
</head>

<body>
    <b:section id='main' name='Main' showaddelement='yes'>
        <b:widget id="Blog1" locked="false" title="Anything" type="Blog" pageType="all">
            <b:includable id='main' var='AnythingWidget'>
                <b:if cond='data:blog.pageType == "index"'>
                    <table border="1">
                        <tr>
                            <th>Title</th>
                            <th>Link</th>
                        </tr>
                        <b:loop var='post' values='data:posts'>
                            <b:include name="post_preview" data="post" />
                        </b:loop>
                    </table>
                </b:if>
                <b:if cond='data:blog.pageType == "static_page"'>
                    <b:loop var='post' values='data:posts'>
                        <b:include name="page_content" data="post" />
                    </b:loop>
                </b:if>
                <b:if cond='data:blog.pageType == "item"'>
                    <b:loop var='post' values='data:posts'>
                        <b:include name="post_detail" data="post" />
                    </b:loop>
                </b:if>
            </b:includable>
            <b:includable id='post_preview' var="post">
                <tr>
                    <td>
                        <data:post.title />
                    </td>
                    <td>
                        <a expr:href="data:post.url">
                            <data:post.url /></a>
                    </td>
                </tr>
            </b:includable>
            <b:includable id="post_detail" var="post">
                <table>
                    <tr>
                        <th>
                            <h2>
                                <data:post.title />
                            </h2>
                        </th>
                    </tr>
                    <tr>
                        <td>
                            <data:post.body />
                        </td>
                    </tr>
                </table>
            </b:includable>
            <b:includable id="page_content" var="post">
                <table>
                    <tr>
                        <th>
                            <h2>
                                <data:post.title />
                            </h2>
                        </th>
                    </tr>
                    <tr>
                        <td>
                            <data:post.body />
                        </td>
                    </tr>
                </table>
            </b:includable>
        </b:widget>
    </b:section>
</body>
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"
    integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"
    crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"
    integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49"
    crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"
    integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy"
    crossorigin="anonymous"></script>

</html>

我能够在索引页中显示帖子,帖子详细信息和静态页面内容。下图显示了我的索引页面。

我要添加的是:

  • 呈现我创建的所有静态页面的链接列表,
  • 呈现标签的链接列表,
  • 呈现页码的链接列表。

有人可以帮助我吗?我已经从下面的网站上学习了,但是仍然不知道如何添加这些小部件。

请不要将我引至模板应用程序。 谢谢。

enter image description here

0 个答案:

没有答案