Spring Boot Thymeleaf 公共布局
Spring Boot Thymeleaf 大约 1180 字fragment
定义公共模板footer.html
,位于resources/templates/portal
文件夹下。
<footer class="footer">
<p>
<th:block th:text="'©' + ${#temporals.year(#temporals.createNow())}"></th:block>
<a th:if="${@portal.icp}" th:text="${@portal.icp.getId()}" th:href="${@portal.icp.getLink()}" target="_blank"></a>
<a style="color:#4CAF50;" href="https://www.aliyun.com/minisite/goods?userCode=id54txo0"
target="_blank">阿里云</a>
</p>
<p>
<th:block th:if="${@portal.comment.enabled}">
<a th:if="${@portal.comment.type == 'giscus'}" href="/message-board.html" title="留言板"></a>
<a href="/sitemap.xml">网站地图</a>
<a th:if="${@portal.github}" th:href="${@portal.github}" target="_blank">GitHub</a>
</th:block>
</p>
</footer>
insert
在其他HTML
文件中使用th:insert
引入footer
,<footer></footer>
会被包裹在div
中。
<div th:insert="~{portal/footer}"></div>
replace
在其他HTML
文件中使用th:replace
引入footer
,则div
不会被渲染,而是直接渲染<footer></footer>
。
<div th:replace="~{portal/footer}"></div>
阅读 99 · 发布于 2023-08-16
————        END        ————
Give me a Star, Thanks:)
https://github.com/fendoudebb扫描下方二维码关注公众号和小程序↓↓↓

昵称:
随便看看
换一批
-
Java 并发编程之 AQS ReentrantLock 公平锁源码解析阅读 1522
-
Spring Boot 返回值额外增加了一些字段阅读 214
-
GitHub OpenSSL SSL_connect: SSL_ERROR_SYSCALL in connection to github.com:443阅读 5893
-
Android 闪屏页全屏显示阅读 3203
-
Android 调节手机亮度阅读 4998
-
MySQL 分组阅读 1815
-
Elasticsearch 监控运行状态阅读 2206
-
Redis 命令行显示中文阅读 3521
-
Spring Boot Thymeleaf 获取常量阅读 108
-
Redis 最大内存策略阅读 1636