如何在 Hippo CMS 中包含 CSS 文件?
How to include CSS file in Hippo CMS?
我正在使用 HippoCMS 10。我从官方网站上做了 "Hello World" 教程。现在我想包含 CSS 文件和样式。我这样做了:
<html>
<head>
<link rel="stylesheet" href="<@hst.webfile path='/css/screen.css' />" type="text/css"/>
</head>
<body>
<h1>Hello World </h1>
</body>
</html>
但是当我尝试打开页面 (http://localhost:8080/site/) 时出现此错误:
[INFO] [talledLocalContainer] Java stack trace (for programmers):
[INFO] [talledLocalContainer] FTL stack trace ("~" means nesting-related):
[INFO] [talledLocalContainer] - Failed at: @hst.webfile path="/css/screen.css"
[in template "webfile:/freemarker/kkbp/homepage-main.ftl" at line 3, column 38
]
[INFO] [talledLocalContainer] ----
[INFO] [talledLocalContainer] ----
[INFO] [talledLocalContainer] freemarker.core.InvalidReferenceException: [... Ex
ception message was already printed; see it above ...]
[INFO] [talledLocalContainer] at freemarker.core.InvalidReferenceException.get
Instance(InvalidReferenceException.java:116)
[INFO] [talledLocalContainer] at freemarker.core.UnexpectedTypeException.newDe
sciptionBuilder(UnexpectedTypeException.java:60)
[INFO] [talledLocalContainer] at freemarker.core.UnexpectedTypeException.<init
我无法处理什么问题。在我发现的每个示例中,我所做的都是完全相同的事情。 CSS 文件的位置 i
..\bootstrap\webfiles\src\main\resources\site\css\screen.css
将这些行添加到您的代码中可能会解决问题。
<!doctype html>
<#include "../include/imports.ftl">
编辑:
获取错误日志的最简单方法是从此处获取它们:target\tomcat8x\logs\hippo-site.log
我正在使用 HippoCMS 10。我从官方网站上做了 "Hello World" 教程。现在我想包含 CSS 文件和样式。我这样做了:
<html>
<head>
<link rel="stylesheet" href="<@hst.webfile path='/css/screen.css' />" type="text/css"/>
</head>
<body>
<h1>Hello World </h1>
</body>
</html>
但是当我尝试打开页面 (http://localhost:8080/site/) 时出现此错误:
[INFO] [talledLocalContainer] Java stack trace (for programmers):
[INFO] [talledLocalContainer] FTL stack trace ("~" means nesting-related):
[INFO] [talledLocalContainer] - Failed at: @hst.webfile path="/css/screen.css"
[in template "webfile:/freemarker/kkbp/homepage-main.ftl" at line 3, column 38
]
[INFO] [talledLocalContainer] ----
[INFO] [talledLocalContainer] ----
[INFO] [talledLocalContainer] freemarker.core.InvalidReferenceException: [... Ex
ception message was already printed; see it above ...]
[INFO] [talledLocalContainer] at freemarker.core.InvalidReferenceException.get
Instance(InvalidReferenceException.java:116)
[INFO] [talledLocalContainer] at freemarker.core.UnexpectedTypeException.newDe
sciptionBuilder(UnexpectedTypeException.java:60)
[INFO] [talledLocalContainer] at freemarker.core.UnexpectedTypeException.<init
我无法处理什么问题。在我发现的每个示例中,我所做的都是完全相同的事情。 CSS 文件的位置 i
..\bootstrap\webfiles\src\main\resources\site\css\screen.css
将这些行添加到您的代码中可能会解决问题。
<!doctype html>
<#include "../include/imports.ftl">
编辑: 获取错误日志的最简单方法是从此处获取它们:target\tomcat8x\logs\hippo-site.log