Html 我应该包含一个 <meta generator> 标签吗?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3632166/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 04:21:59  来源:igfitidea点击:

Should I include a <meta generator> tag?

htmlgeneratormeta-tags

提问by configurator

Suppose I have some sort of proprietary web framework. Should I include a <meta generator="My framework">tag in the generated files?

假设我有某种专有的 Web 框架。我应该<meta generator="My framework">在生成的文件中包含一个标签吗?

I noticed that StackExchange 0.9 applications do that, and wondered what are the pros/cons of doing it. Does it have any effect, or is it just useful for people looking at the source to see?

我注意到 StackExchange 0.9 应用程序会这样做,并想知道这样做的利弊是什么。它有什么作用,还是只是对看源码的人有用?

回答by BoltClock

I've never seen a tag formatted like that before, with an attribute called generatorand the generating software as its value. Usually you'll see it presented as name="generator"and the generating software as its corresponding content, for example:

我以前从未见过这样格式化的标签,其属性称为属性generator,生成软件作为其值。通常你会看到它呈现为name="generator"和生成软件为其对应的内容,例如:

<meta name="generator" content="WordPress 3.0.1" /> <!-- leave this for stats -->

Previously I was unaware of any standard for this, however it looks like HTML5has gone ahead and standardized the use of "generator" as a metadata name. It describes it thus:

以前我不知道有任何标准,但是看起来HTML5已经提前并将“生成器”的使用标准化为元数据名称。它是这样描述的:

The value must be a free-form string that identifies one of the software packages used to generate the document. This value must not be used on pages whose markup is not generated by software, e.g. pages whose markup was written by a user in a text editor.

该值必须是一个自由格式的字符串,用于标识用于生成文档的软件包之一。该值不得用于标记不是由软件生成的页面,例如标记是由用户在文本编辑器中编写的页面。

In the past when dynamic web apps weren't that prevalent, certain web site editors, like FrontPage (there, I said it), would automatically insert generator tags when you create new HTML documents or publish sites using them. This was taken to mean "This page was created using FrontPage". I don't think any modern editors or IDEs do this anymore, but I could be wrong. It's definitely commonly used in dynamic web apps today, however.

在过去,当动态 Web 应用程序不那么流行时,某些网站编辑器,例如 FrontPage(我说过),会在您创建新的 HTML 文档或使用它们发布网站时自动插入生成器标记。这意味着“此页面是使用 FrontPage 创建的”。我认为任何现代编辑器或 IDE 都不会再这样做了,但我可能是错的。然而,它绝对常用于当今的动态 Web 应用程序中。

回答by Jay

A benefit (or a con?) is that you can show up in searchesdone for generator.

一个好处(或一个缺点?)是您可以出现在对生成器进行的搜索中