Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Should I remove trailing slashes in meta tags?

W3c markup validation is asking me to remove trailing slashes on my page. Is this correct? Aand will my page still be compliant in all browsers?

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

<meta http-equiv="content-style-type" content="text/css" **/**>
like image 970
c14kaa Avatar asked Jul 22 '10 16:07

c14kaa


People also ask

Is trailing slash good for SEO?

A trailing slash at the end of a URL on your website can cause issues with duplicate content if not dealt with correctly. Put simply, Google doesn't like seeing the same content on different pages. It can be confusing for both search engines and users.

Should I use trailing slashes?

Historically, a trailing slash marked a directory and a URL without a trailing slash at the end used to mean that the URL was a file. Today, however, trailing slashes are purely conventional, and Google does not care whether you use them; as long as you're consistent.

Do meta tags need closing slash?

<meta> HTML Tag The <meta> element is used to add machine-readable information to an HTML document. Information added with the <meta> tag is not displayed to website visitors but is provided for use by browsers and web crawlers. This element must not contain any content, and does not need a closing tag.

Should you include trailing slash in URL?

If your site has a directory structure, it's more conventional to use a trailing slash with your directory URLs (for example, example.com/directory/ rather than example.com/directory ), but you can choose whichever you like. Be consistent with the preferred version. Use it in your internal links.


2 Answers

That is correct. For HTML 4.01 you shouldn't have trailing slashes (self-closing tags) for meta elements and I believe <link> elements if memory serves me correctly.

xhtml requires trailing slashes, though.

like image 61
Armstrongest Avatar answered Sep 23 '22 12:09

Armstrongest


XHTML is HTML with an XML syntax. In XML all tags must be closed. Some HTML tags do not have closing tags so in XHTML they need to be self closed. This is achieved through placing an / in front of the >.

So any tags that you have with /> must be changed to remove the forward slash to be HTML conformant.

These aren't the only differences between the two specifications.

like image 44
Philip Smith Avatar answered Sep 23 '22 12:09

Philip Smith