Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

no 404 on dynamic span pages

Quote Reply
no 404 on dynamic span pages
Hi,

I had some problems with google indexing pages that do not exist. As I expect Andy beeing around I use Ultranerds.com to illustrate what I mean:
http://www.ultranerds.co.uk/...s_Plugins/more3.html
http://www.ultranerds.co.uk/...Plugins/more500.html
are valid pages with no content.
I have a quick and dirty solution which would be nice to have implemented and improved.

in Build.pm I added:
Code:
sub build_category {
...
#++
if ($numlinks > 0 && $numlinks <= (($nh-1) * $lpp)) {
print "Status: 404" . $GT::CGI::EOL if $CFG->{dynamic_404_status};
print $IN->header();
print Links::SiteHTML::display('error', { error => 'Status: 404'});
exit;
}
#++
}
return Links::SiteHTML::display('category', \%tplvars);
}
END_OF_SUB

and in Page.pm I modified:

Code:
sub generate_category_page {
...
if ($id) {
print $IN->header();
print Links::Build::build('category', \%opts);
}
else {
print "Status: 404" . $GT::CGI::EOL if $CFG->{dynamic_404_status};
print $IN->header();
print Links::SiteHTML::display('error', { error => Links::language('PAGE_INVALIDCAT', $page) });
}
}

to

Code:
sub generate_category_page {
...
if ($id) {
my $category_built = Links::Build::build('category', \%opts);
print $IN->header();
print $category_built;
}
else {
print "Status: 404" . $GT::CGI::EOL if $CFG->{dynamic_404_status};
print $IN->header();
print Links::SiteHTML::display('error', { error => Links::language('PAGE_INVALIDCAT', $page) });
}
}

I do not like adding $category_built but the fact that $IN->header(); is placed before the routine calling build_category prevents me from inserting the 404 before the header.

Not sure why google started to invent pages but I will try to find out, nevertheless 404 for non existing pages seems to make sense.
There might be a problem if pages start spaning because of categories, I will take a look there as well and hope to get some feedback.

Cheers

n||i||k||o

Last edited by:

el noe: Mar 8, 2016, 3:10 AM
Quote Reply
Re: [el noe] no 404 on dynamic span pages In reply to
Hi,

Yeah - thats a bug I've known about for a while (with dynamic pages). I would probably have approached it the same way as you have (maybe with a plugin on the PRE handle_page function) ... but what you have would also work ok :) Would be nice if there was an official fix for it.

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] no 404 on dynamic span pages In reply to
Hi Andy,

Did not think about the Plugin way, but you are certainly right, would be a nicer approach if there is no official fix.

Thanks for your feedback

n||i||k||o