Meta标签上的Thymeleaf功能(Thymeleaf functionality on Meta tag)
我不确定这是否是已知的情况。 但是我很困惑,因为我找不到任何讨论。
提高我的澄清。 基于
thymeleaf
的html
页面是否允许meta
标签位于其头部?我有这样的代码 :
<!DOCTYPE HTML> <html xmlns:th="http://www.thymeleaf.org"> <head> <title>Data Services Platform Support</title> <div th:replace="fragments/header :: header-css" /> <script src="https://cdnjs.cloudflare.com/ajax/libs/angular-smart-table/2.1.8/smart-table.min.js"></script> <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans" /> <link rel="stylesheet" type="text/css" href="webjars/bootstrap/3.3.7/css/bootstrap.min.css" /> <link rel="stylesheet" th:href="@{/css/main.css}" href="../../css/main.css" /> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> </head> <body> ... </body> </html>
它显示我正在寻找的页面。
但是,当我尝试添加
meta
标记来升级我的页面时,只有很少的功能(需要meta
标记), 所以白标错误页面就是我所得到的。我修改的代码 :
<!DOCTYPE HTML> <html xmlns:th="http://www.thymeleaf.org"> <head> <title>Data Services Platform Support</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <div th:replace="fragments/header :: header-css" /> <script src="https://cdnjs.cloudflare.com/ajax/libs/angular-smart-table/2.1.8/smart-table.min.js"></script> <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans" /> <link rel="stylesheet" type="text/css" href="webjars/bootstrap/3.3.7/css/bootstrap.min.css" /> <link rel="stylesheet" th:href="@{/css/main.css}" href="../../css/main.css" /> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> </head> <body> ... </body> </html>
有什么我需要考虑的吗? 请帮忙。
I'm not sure if this could be a known scenario. But I'm confused since I couldn't find any discussions on this.
Raising my clarification. Does
thymeleaf
basedhtml
page allowmeta
tags within its head?I've this code:
<!DOCTYPE HTML> <html xmlns:th="http://www.thymeleaf.org"> <head> <title>Data Services Platform Support</title> <div th:replace="fragments/header :: header-css" /> <script src="https://cdnjs.cloudflare.com/ajax/libs/angular-smart-table/2.1.8/smart-table.min.js"></script> <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans" /> <link rel="stylesheet" type="text/css" href="webjars/bootstrap/3.3.7/css/bootstrap.min.css" /> <link rel="stylesheet" th:href="@{/css/main.css}" href="../../css/main.css" /> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> </head> <body> ... </body> </html>
which displays the page I'm looking for.
But when I tried adding the
meta
tag to upgrade my page with few functionalities(which require ameta
tag), Whitelabel Error Page is all what I get.My modified code:
<!DOCTYPE HTML> <html xmlns:th="http://www.thymeleaf.org"> <head> <title>Data Services Platform Support</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <div th:replace="fragments/header :: header-css" /> <script src="https://cdnjs.cloudflare.com/ajax/libs/angular-smart-table/2.1.8/smart-table.min.js"></script> <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans" /> <link rel="stylesheet" type="text/css" href="webjars/bootstrap/3.3.7/css/bootstrap.min.css" /> <link rel="stylesheet" th:href="@{/css/main.css}" href="../../css/main.css" /> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> </head> <body> ... </body> </html>
Is there something I need to consider? Please help.
最满意答案
是的,Thymeleaf支持所有标签。 如果您使用的是旧版的thymeleaf,则可能需要有效的xhtml。 所以你的meta标签应该看起来像这样:
<meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1" />
(与结束斜线)。 服务器日志错误消息将包含错误的详细信息。
Yes, Thymeleaf supports all tags. If you are using an old version of thymeleaf, it may be likely that it needs to be valid xhtml. So your meta tags should looks like this:
<meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1" />
(with the ending slash). The server log error message will contain the details of the error.
相关问答
更多-
想想使用Mac OS X的全功能Emacs。我使用Carbon Emacs,但我相信别人(说Aqua Emacs或X11 Emacs)会做的。 如果您坚持在终端中使用Emacs,则可以使用Cx 8前缀作为组合键。 尝试Cx 8 Ch获取可能性列表。 请参见http://www.emacswiki.org/emacs/EmacsForMacOS Think about using a full featured Emacs for Mac OS X. I use Carbon Emacs but I beli ...
-
HTML:元描述标签的用途(HTML: Meta description tag's uses)[2022-08-16]
对于内部网站,没有理由添加description元标记。 这确实适用于搜索引擎的使用,所以除非你使用内部搜索引擎(比如谷歌迷你 ),这完全是不必要的。 从维基百科 - 描述属性 : description属性提供了网页内容的简要说明。 这样,如果搜索引擎无法根据页面内容自动创建自己的描述,则网页作者可以为列表提供比可能显示的更有意义的描述。 (强调我的) For an internal site there is no reason to add a description meta tag. It is ... -
在SEO方面, 描述元标记是大多数搜索引擎通常会在搜索结果中显示的内容,因此非常重要。 谷歌已经表示他们根本不使用关键字标签。 如果有的话,其他搜索引擎非常重视它。 如果您想阻止SE索引某些页面, 机器人标签会很有用,但使用robots.txt是更好的选择。 当然,不要打扰像INDEX, FOLLOW这样的“积极”指令INDEX, FOLLOW因为无论如何这都是SE默认做的。 如果您有该选项,则最好使用HTTP标头替换语言和内容类型标记。 同样适用于缓存,重新访问等,但我不确定任何浏览器都会注意到这一点。 ...
-
Sitecore Meta标签(Sitecore Meta tags)[2022-06-30]
现有两个Sitecore Marketplace模块可以执行此操作: Metatag Manager和Meta-tags 。 否则,您可以通过将metatag字段添加到模板并输出它们(使用渲染或子布局)来创建自己的字段。 There's two existing Sitecore Marketplace modules that do this: Metatag Manager and Meta-tags. Otherwise you could create your own by adding the ... -
是的,Thymeleaf支持所有标签。 如果您使用的是旧版的thymeleaf,则可能需要有效的xhtml。 所以你的meta标签应该看起来像这样: (与结束斜线)。 服务器日志错误消息将包含错误的详细信息。 Yes, Thymeleaf supports all tags. If you are using an ...
-
根据RFC 6797,用户代理不关注元素上的HSTS属性设置。 According to RFC 6797 User Agents are not to heed the HSTS attribute settings on elements.
-
元标记定义了您使用的字符集/编码,如UTF-8,ISO-8859-1或类似的东西。 虽然html lang标签定义了使用的语言,如en-EN,de-DE等。 The meta-tag defines your used charset/encoding like UTF-8, ISO-8859-1 or something like that. While the html lang tag defines the used language like en-EN, de-DE and so on.
-
TagHelper用于标签(TagHelper for tags)[2023-03-11]
好吧,在我发布问题之前没有检查这个问题我感到非常愚蠢,但是很明显,正是输入弄乱了TagHelper 。 它说Tag helpers must have a start and end tag or be self closing. 显然,这意味着进入的meta元素必须有一个结束标记或自我关闭,这(我的前/后样本中所示)我的meta元素没有。 所以要修复,我只需要让输入meta标记自行关闭(即在结束时添加一个/ ):正式地, meta标记似乎没有description属性。 参考: https : //developer.mozilla.org/en-US/docs/Web/HTML/Element/meta#Attributes 如果你不在乎,你仍然可以包括它(我很确定没有什么会破坏,除了一些温柔的灵魂),或者如果你关心的话就把它留下来,然后Pinterest会使用这里提到的默认英文信息。 Officially the meta tag does not seem to have a description attr ...HTML 标记(HTML tag)[2022-11-05]
Refresh元标记会自动将浏览器重定向到指定时间后给定的URL。 如果没有看到您正在使用的教程,我无法想象为什么您需要将它用于您的任务。 https://en.wikipedia.org/wiki/Meta_refresh The Refresh meta-tag automatically redirects the browser to the URL given after the specified amount of time. Without seeing the tutorial you a ...相关文章
更多- HTML meta标签
- 关于微信公众号内嵌网页的几个meta标签
- 删除Hbase的META中多余表项
- Thymeleaf+SpringMVC5示例教程
- Spring Boot CLI 基于Thymeleaf的示例
- Struts2 Push Tag 引发的问题
- 怎么高效率从Tag 里面抽取有用信息
- Thymeleaf标准方言SpringStandard
- 标签功能发布完成及对cms频道的设计的思考
- cms中标签的设计与实现
最新问答
更多- 在javascript中创建类以创建对象并在Java中创建类和对象之间的区别(Difference between creating a class in javascript to create an object and creating an class and object in Java)
- Facebook API:将身份验证详细信息从Javascript SDK发送到PHP SDK(Facebook API: Send authentication detail from Javascript SDK to PHP SDK)
- 如何停止队列动画jquery?(How can I stop queue animation jquery?)
- 使用C#的井字游戏中的人工智能(Artificial Intelligence in Tic-Tac-Toe using C#)
- 多少流量可以共享虚拟主机(对于Python Django站点)支持?(How Much Traffic Can Shared Web Hosting (for a Python Django site) support?)
- 带有CIFilters的CAShapeLayer(CAShapeLayer with CIFilters)
- 如何在Angular 2中读取JSON #text(How to read in Angular 2 the JSON #text)
- 如何在xml中读取自闭标签的属性?(How to read self closing tag's attribute in xml?)
- 无法使用http put将图像上传到亚马逊S3(Cannot upload image to amazon s3 using http put)
- 文件结束无限循环(end of file infinite while-loop)
- 在cpp的模板(template in cpp)
- 在构建库时,clang和clang ++有什么区别?(What's the difference between clang and clang++ when building a library?)
- ng类中的表达式(expression inside ng-class)
- 在PHP中获取随机布尔值true / false(Get random boolean true/false in PHP)
- 管道的高效分块用于严格的字节串(Efficient chunking of conduit for strict bytestring)
- Python ternary_operator(如果其他标志做了其他操作,则执行其他操作)(Python ternary_operator (do-somthing if flag else do-another))
- Sencha Touch面具发布(Sencha Touch mask ondisclosure)
- 验证脚本上的通知[重复](Notices on validation script [duplicate])
- 朋友功能(friend function)
- 基于角坐标平移和变换平面几何(Translate and transform plane geometry based on corner coordinates)
- Rails:'如果在本地运行'条件javascript标记包括(Rails: 'if running locally' conditional javascript tag include)
- 解压文件(Unzipping files)
- 使用ui-router以角度加载变量状态(loading in variable states with ui-router in angular)
- 创建Azure云服务需要多长时间?(how long does it take to create an Azure Cloud Service? How to view log information?)
- 指向整数的指针数组(Array of pointers to integers)
- Laravel服务提供商没有看到我的包的主要类(Laravel service provider does not see the main class of my package)
- 这个关于VSS / RSS / PSS / USS的解释是否准确?(Is this explanation about VSS/RSS/PSS/USS accurate?)
- 在Django-Admin中通过row-id排序显示项目(Ordering the display items by row-id in Django-Admin)
- 如何使用cythonize启用`--embed`?(How to enable `--embed` with cythonize?)
- 用于将文本多行设置的Excel脚本(Excel script for ereasing text multiple rows)