1 mercury Feb 28, 2007 12:44
3 mercury Mar 02, 2007 11:19
thanks but that didn't work
any other ideas?
4 yabba 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 mercury 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 yabba Mar 02, 2007 11:30
If you click the "leave a comment" then it should show you the comments
¥
7 mercury 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 edb 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 yabba 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 mercury 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 yabba Mar 02, 2007 12:06
Do you have a link to where you're testing this?
¥
12 mercury Mar 02, 2007 12:18
http://www.adamturner.com.au/hydrapinion/index.php/play/2007/01/11/test_post_for_length
It's my test site for hydrapinion.com
13 yabba 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 mercury 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 yabba 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 mercury 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 yabba 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 mercury Mar 04, 2007 01:07
thanks again, I tried it a dozen different ways but couldn't quite get it
19 mercury 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', ' • ' ) // Link to trackbacks ?>
<?php $Item->feedback_link( 'pingbacks', ' • ' ) // Link to trackbacks ?>
so it points at the new comments page?
20 edb 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>
21 mercury Mar 04, 2007 01:42
okay, thanks
22 yabba 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', ' • ' ); // Link to trackbacks
$Item->feedback_link( 'pingbacks', ' • ' ); // Link to trackbacks
$raw = ob_get_contents();
ob_end_clean();
echo str_replace( '#', '&anything=something#', $raw );
?>
¥
23 mercury Mar 04, 2007 10:15
Excellent, thanks. I had to make one slight change to make it work - replace & with ? so it looks like;
echo str_replace( '#', '?anything=something#', $raw );
Thanks again for your help.
24 yabba Mar 04, 2007 10:25
No problem ;)
¥
25 mercury 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 mercury 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 yabba 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 mercury 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 mercury 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 yabba 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 mercury 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 mercury 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 yabba Mar 06, 2007 08:09
That code needs to come before your meta tag code ;)
¥
34 mercury Mar 06, 2007 13:08
that fixed it, thanks
have asked Google to look at the site again
35 mercury 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 yabba Mar 09, 2007 11:39
I'd be asking google what url they're looking at ;)
You should always put a space before /> ;)
¥
37 edb 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 mercury 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 quard Mar 10, 2007 05:34
Google ate my friend's parents...
40 yabba Mar 13, 2007 14:00
Did you get any joy out of google yet?
¥
41 mercury 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 yabba Mar 13, 2007 14:18
No problem, anything to win against googy huh? ;)
¥
43 mercury 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.
This "may" work, crack open /skins/<skin>/_main.php and add this somewhere near the top :-
¥