Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   Sidebars & Widgets (http://forum.bytesforall.com/forumdisplay.php?f=14)
-   -   [SOLVED] Wrapping sidebar with class="nocontent" (http://forum.bytesforall.com/showthread.php?t=16419)

ymf Jan 4, 2012 07:27 PM

[SOLVED] Wrapping sidebar with class="nocontent"
 
I'd like to have something like
HTML Code:

<td id="right-inner" class="nocontent"> ... </td>
i.e. surround a sidebar (footer, header, widget...) area with a class="nocontent". Preferably, I'd like to do it without having to modify the theme's code :).

Why I want it? -- to tell Google Custom Search that the sidebar has a boilerplate content that's not relevant to the main content of the page. When Google Custom Search sees this tag, they ignore any keywords it contains and won't take them into account when calculating ranking for the Custom Search engine (see http://support.google.com/customsear...answer=2364585).

juggledad Jan 5, 2012 06:15 AM

the only way to do it, currently, is to modify the theme code.

juggledad Jan 5, 2012 08:09 AM

why not add a text widget and put your boilerplate in it wrapped in a div with that class.

ymf Jan 5, 2012 08:53 AM

I want to exclude from Google Custom Search Engine (CSE) indexing the whole side bar with all its widgets. Not just one particular "boilerplate" widget.

For (an artificial) example, say I have a post titled "Hello World" placed in the category "Hello World" and also tagged "Hello World". When I search for a phrase "Hello World", I want Google's CSE to return precisely that one particular post. However, the words "Hello World" will be picked by "Recent Posts / Recent Comments / Categories / Tags" and who knows what other plugins, and placed on the navigation sidebars of all blog pages. I may also have an external blogroll link conveniently named "Hello World" -- it will also be in the navigation sidebars of all blog pages. Thus, the Google CSE will return all (irrelevant) blog posts, not just the one titled "Hello World".

My opinion: since Google stepped in with this class="nocontent" idea, we should all take a notice. It would be nice if Atahualpa could support this new concept in some future version.

juggledad Jan 5, 2012 09:14 AM

for now you will need to edit header.php for the left and left-inner sidebars and footer.php for the right-inner and right sidebars.

actually it would be nice if someone created a plugin that would add that option to each widget you use.

ymf Jan 7, 2012 03:15 PM

wordpress.org/extend/plugins/zigwidgetclass/ seems to be exactly what the doctor prescribed:
Quote:

ZigWidgetClass adds a free text field to each widget control form on your widget admin page. Enter a class name in the box and it will be added to the classes that WordPress applies to that widget instance. It only works with widgets created by extending the built-in multi widget class
I will try it. People praise that this "ZigWidgetClass" plugin is compatible with "Widget Logic" plugin, another intriguing little gem.

ymf Jan 8, 2012 03:58 PM

There was only one minor issue installing ZigWidgetClass: it didn't work with "BFA Recent Comments" widget (maybe because ZigWidgetClass only works with widgets created by extending the built-in multi widget class?). So I switched from "BFA Recent Comments" to "Better WordPress Recent Comments" (wordpress.org/extend/plugins/bwp-recent-comments/).

Still haven't checked whether this class="nocontent" works as advertised in Google Custom Search.

I wanted to share two other pointers about excluding portions of a page from indexing by search engines:

Yahoo! introduced in 2007 a similar class="robots-nocontent" that is supposed to exclude portions of a page from their mainstream search engine (see www.ysearchblog.com/2007/05/02/introducing-robots-nocontent-for-page-sections/).

Google AdSense has tags <!-- google_ad_section_start --> ... <!-- google_ad_section_end --> to emphasize portions of a page for ad targeting purposes (see support.google.com/adsense/bin/answer.py?hl=en&answer=23168).


All times are GMT -6. The time now is 10:52 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.