te')); return $arr; } /* 遍历用户所有主题 * @param $uid 用户ID * @param int $page 页数 * @param int $pagesize 每页记录条数 * @param bool $desc 排序方式 TRUE降序 FALSE升序 * @param string $key 返回的数组用那一列的值作为 key * @param array $col 查询哪些列 */ function thread_tid_find_by_uid($uid, $page = 1, $pagesize = 1000, $desc = TRUE, $key = 'tid', $col = array()) { if (empty($uid)) return array(); $orderby = TRUE == $desc ? -1 : 1; $arr = thread_tid__find($cond = array('uid' => $uid), array('tid' => $orderby), $page, $pagesize, $key, $col); return $arr; } // 遍历栏目下tid 支持数组 $fid = array(1,2,3) function thread_tid_find_by_fid($fid, $page = 1, $pagesize = 1000, $desc = TRUE) { if (empty($fid)) return array(); $orderby = TRUE == $desc ? -1 : 1; $arr = thread_tid__find($cond = array('fid' => $fid), array('tid' => $orderby), $page, $pagesize, 'tid', array('tid', 'verify_date')); return $arr; } function thread_tid_delete($tid) { if (empty($tid)) return FALSE; $r = thread_tid__delete(array('tid' => $tid)); return $r; } function thread_tid_count() { $n = thread_tid__count(); return $n; } // 统计用户主题数 大数量下严谨使用非主键统计 function thread_uid_count($uid) { $n = thread_tid__count(array('uid' => $uid)); return $n; } // 统计栏目主题数 大数量下严谨使用非主键统计 function thread_fid_count($fid) { $n = thread_tid__count(array('fid' => $fid)); return $n; } ?>javascript - Will using CSS display:none negatively affect my search engine ranking? - Stack Overflow
最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Will using CSS display:none negatively affect my search engine ranking? - Stack Overflow

programmeradmin3浏览0评论

So suppose I have legitimate content that's hidden through CSS, and I'm using javascript to selectively display it based on what the user clicks on. Also, non-javascript users can click on the same links and be taken to a new page with the requested content displayed. No hidden keywords or anything like that. I have about 15 paragraphs/mini-sections worth of hidden content that can be revealed by clicking links or using javascript.

How likely is it that this content will get flagged by search engines as putting keywords in hidden content, thus trying to artificially improve my ranking? Obviously this isn't what I'm trying to do -- all the hidden content can be viewed by javascript and non-javascript users. Not hiding the content would basically entail redesigning entire sections of my site, which I'd like to avoid.

For the record, I've done some research into this already, and I think the general consensus is that if you're hiding legitimate content you shouldn't have anything to worry about. Just wanted to get some other opinions and whether or not the fact that the content I'm hiding can be viewed by clicking on certain links will help at all.

So suppose I have legitimate content that's hidden through CSS, and I'm using javascript to selectively display it based on what the user clicks on. Also, non-javascript users can click on the same links and be taken to a new page with the requested content displayed. No hidden keywords or anything like that. I have about 15 paragraphs/mini-sections worth of hidden content that can be revealed by clicking links or using javascript.

How likely is it that this content will get flagged by search engines as putting keywords in hidden content, thus trying to artificially improve my ranking? Obviously this isn't what I'm trying to do -- all the hidden content can be viewed by javascript and non-javascript users. Not hiding the content would basically entail redesigning entire sections of my site, which I'd like to avoid.

For the record, I've done some research into this already, and I think the general consensus is that if you're hiding legitimate content you shouldn't have anything to worry about. Just wanted to get some other opinions and whether or not the fact that the content I'm hiding can be viewed by clicking on certain links will help at all.

Share Improve this question asked Feb 4, 2011 at 4:35 user599599user599599 1332 silver badges9 bronze badges 1
  • 1 If you're more interested in the SEO perspective rather than other JS solutions, then this should be moved to webmasters.stackexchange.. – Lèse majesté Commented Feb 4, 2011 at 4:46
Add a ment  | 

7 Answers 7

Reset to default 6

Why don't you make it so it degrades gracefully for user agents without JavaScript?

(function() {

    var element = document.getElementById('some-element'),
        previousDisplay;

    window.onload = function() {
       previousDisplay = element.style.display;
       element.style.display = 'none';
    };

    document.getElementById('some-buton').onclick = function() {
        element.style.display = previousDisplay;
    }

})();

That way, on load, your element will be hidden via JavaScript, and then shown when you want it to.

Note: You are better off using a cross browser patible onDOMReady event here, otherwise your browser will download all assets before firing onload.

There are mixed answers on this topic, but hidden elements are generally considered a "black hat" Search Engine Optimization (SEO) technique. (See this reference) Google and other search engines have lowered the ranking of sites or removed site altogether based on results like this.

You may also want to check these two other similar, but not entirely related, StackOverflow questions:

  1. Google SEO and hidden elements
  2. SEO: does google bot see text in hidden divs

Ofcourse...Using hidden text (giving text and background same color) or hiding a div will cause you website rating down. As this is part of Blackhat SEO technique. Once google or any search engine find it out, they will remove or rank down your website from its indexing.

NO definitely not.

I haven't found any documentation yet but this would be pletely off, Google makes a living out of understanding how the internet and the web pages work, and they DO have to understand that display:none or visibilty:hidden.

By the way, check out their homepage source code they very actively use both mentioned resources.

Use it without fear, this will most likely not affect you SEO at all or in any case, this will be a infamous change, specially if you do the important stuff correctly!

Good luck!

I don't believe that Google et al check visibility of elements because it would be infeasible to do so reliably (imagine all the positioning and layering techniques you could use) and in a way that doesn't penalize legitimate uses (like yours). I've never noticed any problems with it personally, and I've never found any ments from Google employees mentioning it.

So I would say it's pretty safe.

It's been my experience that if you're hiding content, google and other search engines are going to rate you down. They are very, very picky about showing them the same content that users see. I worked on a product that had flash pages and we built non flash pages for SEO purposes (we'd sniff and if the user didn't have flash, we'd show the non flash stuff). As part of our SEO pliance stuff we have to make sure that everything on the non flash was exactly the same as the flash.

Hiding content is considered as a Black hat SEO technique and Google may flag those sites if they find anything suspicious. Back in days, people used CSS display: none feature to hide keywords and for stuffing it. Those illegitimate practices brought results in terms of ranking in early days, which isn’t the case now. With updated Google algorithms rolling out frequently, it has bee sophisticated enough to detect any discrepant or black hat SEO practices. So, if you have any hidden keywords or have tried practice of keyword stuffing then you should be wary as Google may flag the site for making such practices.

However, if you have used it for genuine purpose as mentioned here, then it shouldn’t affect your SEO practice or its ranking. You will be able to adapt feasible SEO techniques and boost your page’s ranking in Google’s SERP (search engine result page).

But, Google might consider it as a black hat technique and rank down your site even if there is legitimate content. If that’s the case, you should be very wary of the changes in results and must change your ways before its too late.

发布评论

评论列表(0)

  1. 暂无评论