Recent Topics

1 Feb 28, 2007 12:44    

My b2evolution Version: 1.9.x

I've applied to have my blog (hydrapinion.com) listed included Google News, but they've told me I need to remove the feedback from the bottom of the permalink pages so they can crawl the posts without including reader comments and other "non-news" items.

The b2evolution list of features includes "Display all feedback on same page or on separate pages by type" but I can't figure out how to do this. How can I create a separate feedback page for each post, leaving just a link to the comments at the bottom of the page? I guess what I'm asking is how can I make the permalink pages look like the posts on the main page - with just:

Leave a comment • Trackback

at the bottom? I'm using version 1.91 with a customised template.

2 Mar 01, 2007 12:20

This "may" work, crack open /skins/<skin>/_main.php and add this somewhere near the top :-

<?php
if( preg_match( '~#comments$~i', $ReqURI ) )
  $c = $tb = $pb = 0;
?>

¥

3 Mar 02, 2007 11:19

thanks but that didn't work

any other ideas?

4 Mar 02, 2007 11:24

Lol, oops, my mistake I forgot an !

The code should read :

<?php
if( !preg_match( '~#comments$~i', $ReqURI ) )
  $c = $tb = $pb = 0;
?>

¥

5 Mar 02, 2007 11:29

That got rid of the comments completely, which isn't quite what I'm trying to do. I want to move the comments, trackbacks etc. to a separate page. Are the comments available on a separate page now or are they hidden completely?

6 Mar 02, 2007 11:30

If you click the "leave a comment" then it should show you the comments

¥

7 Mar 02, 2007 11:36

That doesn't work, when I click that link it tries to take me to the bottom of that page by adding #comments to the URL - but of course it's not there any more. I could redirect that link to a separate comments page, if there is one.

8 Mar 02, 2007 11:41

Are you willing to consider comments in a popup window? I'm not, but it's an easy option if you think it'll satisfy google's evil demands.

9 Mar 02, 2007 11:42

Hmmm, ok, a tad more bending of the core is required!
Where you have something like $Item->feedback_link( 'comments' ); change it to :-

echo '<a href="'.url_add_param( $Item->get_permanent_url(), 'anything=unique' ).'#comments" title="Read/Leave comments">Read this posts comments</a>';

Then the previous code should kick in and sort out the showing/not showing of your comments

¥

10 Mar 02, 2007 12:02

That doesn't seem to make a difference

I added

<?php echo '<a href="'.url_add_param( $Item->get_permanent_url(), 'anything=unique' ).'#comments" title="Read/Leave comments">Read this posts comments</a>'; ?>

which creates a URL ending in;

?anything=unique#comments

but nothing seems to change.

Would the Google crawler still read comments if they were pop-up? It's not my preferred choice. I don't understand why they insist I remove the comments - I write for other news sites that have comments on the same page and Google News happily lists them.

11 Mar 02, 2007 12:06

Do you have a link to where you're testing this?

¥

13 Mar 02, 2007 12:25

Ok, it looks like the "#comments" doesn't get into $ReqURI so you need to change that bit to :-

<?php
if( !param( 'anything', 'string' ) )
  $c = $tb = $pb = 0;
?>

And then the "anything=unique" link should show comments.

¥

14 Mar 02, 2007 12:50

that looks perfect, thanks

the next challenge is to hide the "?anything=unique#comments" pages from Google. After studying the comments on b2evolution SEO a while ago I added this code to _main.php

<meta name="robots" content="<?php if( ( $disp!='posts' && $disp!='single' ) || ( $disp=='posts' && ( $paged>1 || $cat!='' || $m!=0 || ( is_array( $catsel ) && count( $catsel )>0 ) || $w>=0 || $s!='' ) ) ) echo( 'no' ); ?>index,follow"/>

I don't know enough about this stuff to understand exactly what it all means - but it's suppose to ensure that Google only indexes the front page and the posts, not the extra stuff like weekly and monthly views. It seems to work pretty well, although for some reason the RSS pages still get indexed in Google. Do you know how to alter this code so that these comments pages are not indexed (and the RSS)?

15 Mar 02, 2007 13:41

This should work to hide your comments pages as well

<meta name="robots" content="<?php if( $anything || ( $disp!='posts' && $disp!='single' ) || ( $disp=='posts' && ( $paged>1 || $cat!='' || $m!=0 || ( is_array( $catsel ) && count( $catsel )>0 ) || $w>=0 || $s!='' ) ) ) echo( 'no' ); ?>index,follow"/> 

To hide your feeds from google is a tougher challenge

¥

16 Mar 02, 2007 15:35

that's awesome, thank you so much for your help

The only problem now is it breaks the links to the comments in the sidebar. I know I need to change the _includecomments.php file

I'm pretty sure it's this line

<?php $Comment->Item->permanent_link('#title#') ?><br />

but I just don't quite know the syntax. I've had a few goes but I can't crack it (I'm a newbie, as if it doesn't show). Can you tell me what I have to add to the end of permanent_link to add ?anything=unique#comments to the end of the link so it takes me to the comments page?

17 Mar 03, 2007 10:36

You need to change it to look something like this :-

echo '<a href="'.url_add_param( $Comment->Item->get_permanent_url(), 'anything=unique' ).'#comments" title="Read/Leave comments">'.$Comment->Item->title.'</a>';

¥

18 Mar 04, 2007 01:07

thanks again, I tried it a dozen different ways but couldn't quite get it

19 Mar 04, 2007 01:33

just realised that using the new code at the bottom of the posts means it no longer tells me how many comments have been made. Is there any way to change this code;

<?php $Item->feedback_link( 'comments' ) // Link to comments ?>
<?php $Item->feedback_link( 'trackbacks', ' &bull; ' ) // Link to trackbacks ?>
<?php $Item->feedback_link( 'pingbacks', ' &bull; ' ) // Link to trackbacks ?>

so it points at the new comments page?

20 Mar 04, 2007 01:38

<offtopic>Mercury you'll find the buttons for "Code" and/or "PHP" can be your friend. They make it look nice when you paste in code, as you'll see after I make a minor edit to your post above.</offtopic>

22 Mar 04, 2007 09:31

Try this and see what happens ;)

<?php
ob_start();
  $Item->feedback_link( 'comments' ); // Link to comments
  $Item->feedback_link( 'trackbacks', ' &bull; ' ); // Link to trackbacks
  $Item->feedback_link( 'pingbacks', ' &bull; ' ); // Link to trackbacks
  $raw = ob_get_contents();
ob_end_clean();
echo str_replace( '#', '&amp;anything=something#', $raw );
?>

¥

23 Mar 04, 2007 10:15

Excellent, thanks. I had to make one slight change to make it work - replace &amp; with ? so it looks like;

echo str_replace( '#', '?anything=something#', $raw );

Thanks again for your help.

25 Mar 04, 2007 10:40

It's live on the real site now and it seems to be working perfectly; www.hydrapinion.com

Hopefully that's enough to make Google News happy.

26 Mar 04, 2007 14:02

Sorry to ask for more help, but it seems I missed some of the more obscure links to the comments. The last comments list in the sidebar now links to the new comments page when you click on the title of the post, but not on the snippet of text - clicking there still tries to go to the old URL. I know I need to change this line

<div style="cursor:pointer" onclick='window.location="<?php echo $Comment->get_permanent_url(); ?>"'><?php $Comment->content(); ?></div>

in _includecomments.php but once again, after several tries, I can't figure
out how to do it.

Also, the permalinks for the comments no longer work. I think I need to edit this line

<?php	$Comment->permanent_link( '#', '#', 'permalink_right' ); ?>

in _lastcomments.php

27 Mar 04, 2007 14:58

You need something like this for the onclick :-

onclick='window.location.href="<?php echo url_add_param( $Comment->get_permanent_url(), 'anything=foo' ); ?>"'

and something like this for the last bit :-

<?php
ob_start();
  $Comment->permanent_link( '#', '#', 'permalink_right' );
  $raw = ob_get_contents();
ob_end_clean();
echo str_replace( '#', '?anything=bar#', $raw );
?>

¥

28 Mar 04, 2007 16:19

If I use

onclick='window.location.href="<?php echo url_add_param( $Comment->get_permanent_url(), 'anything=unique','#comments' ); ?>"'

I get a URL that ends in #c2?anything=unique instead of ?anything=unique#c2

I need a way to get just the post number.

The alternative is to just remove the link from the text and use

<?php $Comment->content(); ?>

Unless there's an easy way to fix this problem, I think that's probably the best solution.

The second one is more difficult because I can't find the right file to edit. The _lastcomments.php file in my custom folder only says

	require get_path('skins').'/_lastcomments.php';

so I tried editing the _lastcomments.php file one level up in the skins folder, but when I make changes they don't appear on the site - so I can't figure out which page is actually generating the actual comments and the permalink I need to change.

29 Mar 04, 2007 16:29

I figured the second one out, I should have been editing _feedback.php in the skins folder

I substituted unique for bar and it works fine

Hopefully that's the end of it, thanks again for all your help. Hopefully this thread will help others who find themselves in the same boat.

30 Mar 04, 2007 17:33

Ohh, you may have found a bug :P

Change it to this instead :-

onclick='window.location.href="<?php echo str_replace( '#', '?anything=anything_really#', $Comment->get_permanent_url() ); ?>"'

¥

31 Mar 05, 2007 22:43

that fixed it, but when I asked Google to look at the site again I got exactly the same reply;

Thank you for your note. We've reviewed your site
http://www.hydrapinion.com again and we noted that Google News would index your news articles together with your readers' comments. In order to continue including your news content, we need to be able to crawl it without including reader comments and other non-news items.

If you're able to put all of your readers' comments in one directory or folder, you can set up a robots.txt file to prevent Googlebot from accessing that folder. Alternatively, you can use a robots meta tag on each of your comments pages. If each reader comments page includes the appropriate meta tag, our crawler should ignore them.

<snip>

This seems to be an automated reply, it's not telling me where the problem is. My guess is something must have been overlooked in the robots code;

<meta name="robots" content="<?php if( $anything || ( $disp!='posts' && $disp!='single' ) || ( $disp=='posts' && ( $paged>1 || $cat!='' || $m!=0 || ( is_array( $catsel ) && count( $catsel )>0 ) || $w>=0 || $s!='' ) ) ) echo( 'no' ); ?>index,follow"/>

Any suggestions? Can you point me to a reference that will help me decipher this so I can try to solve the problem? Is there a way of testing the site to see the results of this code?

32 Mar 05, 2007 23:00

When I look at the source code from my generated pages, it includes;

<meta name="robots" content="<br />
<b>Notice</b>:  Undefined variable: anything in <b>/home/hydrncom/public_html/skins/custom/_main.php</b> on line <b>64</b><br />
index,follow"/>

Should the robots code come before or after this code;

<?php
if( !param( 'anything', 'string' ) )
  $c = $tb = $pb = 0;
?>

I've got the robots code first.

33 Mar 06, 2007 08:09

That code needs to come before your meta tag code ;)

¥

34 Mar 06, 2007 13:08

that fixed it, thanks
have asked Google to look at the site again

35 Mar 09, 2007 00:39

Now Google says;

Thank you for your reply. We reviewed your site again and this time we found a meta tag blocking our robot's access to your articles. In order to include your news articles in Google News, our crawlers need to be able to visit each article.

What am I doing wrong? All of the articles now contain;


<meta name="robots" content="index,follow"/>

in the header, while the comment pages have;

<meta name="robots" content="noindex,follow"/>

Looking at the code, I've noticed my other meta tags have a space before /> so I'm wondering if I should be using

<meta name="robots" content="index,follow" />

36 Mar 09, 2007 11:39

I'd be asking google what url they're looking at ;)

You should always put a space before /> ;)

¥

37 Mar 09, 2007 12:40

OFFTOPIC? I think google has a department in charge of learning exactly how many hoops a person will try to jump through to make google happy. google is the new microsoft. google is evil.

Back on track, where ¥åßßå takes impossible challenges and turns them into nice neat hacks.

38 Mar 10, 2007 03:37

You might be right EdB, but unfortunately they're the 800 pound Gorilla of the web.

I've asked them what's wrong but they only reply with form letters. I've changed the code to insert space before /> and asked them to check again.

39 Mar 10, 2007 05:34

Google ate my friend's parents...

40 Mar 13, 2007 14:00

Did you get any joy out of google yet?

¥

41 Mar 13, 2007 14:17

yeah, I got an email yesterday saying they're finally happy. It said;

"You should be able to find your articles in Google News within a few weeks."

So we'll just have to wait and see how it goes.

Thanks again for your help, much appreciated.

42 Mar 13, 2007 14:18

No problem, anything to win against googy huh? ;)

¥

43 Mar 13, 2007 14:29

yeah, it was a satisfying win - now to see if it was worth it. The site is a bit of an experiment - I've had plenty of people tell me a model like ours won't work - five blogers, each allocated a topic and a day of the week. People say its not focused enough on one area (which is the whole point). It will be interesting to see what happens.


Form is loading...