【发布时间】:2020-06-01 21:53:05
【问题描述】:
我习惯了th:insert 和th:replace,但我需要一种方法来在标题中包含一个片段,而不会覆盖标题中的其他标签。
我试过这个,但 home.css 头部被完全覆盖:
home.html:
<head th:include="fragments/head :: genericHead">
<link rel="stylesheet" href="home.css">
</head>
头部模板:
<head th:fragment="genericHead">
<link rel="stylesheet" href="common.css">
</head>
我想要一些方法来执行 th:add 或类似操作,以便将两个链接都作为 head 的子级,并导致如下结果:
<head>
<link rel="stylesheet" href="common.css">
<link rel="stylesheet" href="home.css">
</head>
【问题讨论】:
标签: html spring spring-boot spring-mvc thymeleaf