Ali
Ali

Reputation: 10453

How to hide a content from being display on the screen but display only in the source code?

I'm running a Wordpress site and having a tag on the site is a good practice for SEO purpose.

But it is taking a lot of spaces and I figure that not many people will actually find anything using tags. I guess it is only good for SEO purpose like google to index them or something like that.

The question is how can I hide that content and stop it from being display on the screen but not on the source code and not to take the space, meaning I can use that space to display something else but that tags still exist in the source code.

Thanks

Upvotes: 1

Views: 863

Answers (3)

Alex W
Alex W

Reputation: 38193

As an alternative to display: none, I would suggest using HTML meta tags, which always get my pages good indexes in search engines. The meta description tag and meta keywords tags are particularly useful. All meta tags are invisible on pages but show up in the source code, by the way.

Here's an introduction to HTML geared towards Wordpress users: http://om4.com.au/client/html-for-bloggers/

Here are the basic meta tags you should use:

<meta name="description" content="Free Web tutorials" />
<meta name="keywords" content="HTML,CSS,XML,JavaScript" />
<meta name="author" content="Hege Refsnes" />
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />

you simply add these to your pages you want SEO on and then change the content to match your site.

Here's a little more info on meta tags:

http://www.w3schools.com/tags/tag_meta.asp

Edit:

Nowadays, you can't just hide content that is purely for SEO because Google will lower your site in the search rankings. Instead, just make sure you have good content on your site and use heavily things like the image alt attribute.

Here's a snippet from Google about hidden text or links for SEO: https://support.google.com/webmasters/answer/66353

Hiding text or links in your content to manipulate Google’s search rankings can be seen as deceptive and is a violation of Google’s Webmaster Guidelines. Text (such as excessive keywords) can be hidden in several ways, including:

  • Using white text on a white background Locating text behind an image
  • Using CSS to position text off-screen Setting the font size to 0
  • Hiding a link by only linking one small character—for example, a hyphen in the middle of a paragraph

Upvotes: 2

Bobbi Bennett
Bobbi Bennett

Reputation: 1646

What I do, is, I present the page best for SEO, until I sense user interaction (mouse move, mouse down, etc), then the fancy stuff, text graphics and slow graphics start loading. I think most search engines would ignore anything with display:none.

Upvotes: 0

Mathew Thompson
Mathew Thompson

Reputation: 56429

Just use display: none on the content you want to hide, that won't reserve the space, will hide your information and you'll still be able to see it in the source code :).

Upvotes: 3

Related Questions