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
Subject Author Views Date
Thread no 404 on dynamic span pages el noe 3448 Mar 8, 2016, 3:07 AM
Thread Re: [el noe] no 404 on dynamic span pages
Andy 3370 Mar 8, 2016, 3:57 AM
Post Re: [Andy] no 404 on dynamic span pages
el noe 3344 Mar 8, 2016, 5:34 AM