SEO issues with Views 2

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
Z2222's picture

Here's an SEO issue with the Views module. I haven't found a solution yet.

Default views in the Views 2 Module have an SEO issue. They don't send 404 errors when a non-existent URL is requested.

For example, if your view is located at
example.com/articles

and your page is at:
example.com/articles/my-page

but you accidentally link to:
example.com/articles/mypage

Drupal sends a "200 OK" header and the content from:
example.com/articles

instead of sending a 404 header/page.

This could be a problem on large Drupal sites where the view has many URLs of pagination such as:
example.com/articles/mypage?page=123
(The same content as example.com/articles,example.com/articles/mypage, example.com/articles/mypage?page=1, etc.)

Is there a way to fix that in the Views settings or should I add an issue to the Views module?

Originally posted here.

Comments

Um.

NikLP's picture

This sounds either like you are not configuring views correctly or that you should file this as an issue on the views issue queue. Doubt you'll get much further response here, to be honest.

Web Development in Nottingham, UK by Kineta Systems / Follow me on Twitter! @NikLP

 

Z2222's picture

 

Known issue?

Michelle's picture

I'm fairly sure this is a known issue. I don't know the details but I've heard this talked about before on IRC. And I don't think it's something that can be "fixed"

If you search the queue there's probably something there already.

Michelle


See my Drupal articles and tutorials or come check out the Coulee Region

i have also some problems

mp's picture

i have also some problems with views2
the startpage of my website www.ding-dong.at gets a pagerank of 4, but if you visit the site "Immobilien" (this is made with views2) then this site is not ranked ... does anyone have a solution for that?
also the site /faq (link is at the bottom on the left "Fragen und Antworten") is not ranked

greets

Solution...

criznach's picture

I remembered this behavior from a very old site using views 1. We got around it then by adding a dummy argument to the view that returns a 404 when the argument did not return results.

I was just able to build the same solution using views 2 for Drupal 6...

I created a default "frontpage" view. If I visit "frontpage", it displays all of my site's published nodes. If I create a new page at "frontpage/newpage", the path works as expected. If I visit a non-existant page like "frontpage/nopage", it displays a blank page (not a 404 like it should).

Edit your view and add an argument of type Node: nid. Set it to "display all values", validator of "Node", and argument type of "Node ID". Set "Action to take if argument does not validate" to "Hide view / Page not found (404)". Update the argument and save the view.

Now you should be able to visit "frontpage" and see your view. "frontpage/newpage" should show a valid node. "frontpage/nopage" should throw a 404.

Success???

Thanks for posting this

Augusto Ellacuriaga's picture

Thanks for posting this solution. It worked out well. I just have one more question.

I have a view page that needed a different page title (in the title bar) than the title of the page itself. So far, the best way I found to do so is by inserting the view page in a node page and optimizing the page title and meta tags with the respective modules. There is a php way to do it, but hasn't worked that well for me. If you know of a good snippet, please share it.

The new node page then was assigned /nodepage path. But even though it's a node page, when a mistaken path was entered, i.e. /nodepage/saegfad, it defaulted in the views page instead of a 404.

The view page did not have a path defined. I had to add a path, i.e. /page-view-wef4535, in order for the 404 to come up. I'm wondering if there is a way for views to somehow somewhere output that view page path, and therefore, get indexed by search engines. I'm not going to block that page via robots commands, because some smart aleck may link to it and create duplicate content issues by having 2 pages with the same content. And I can't noindex the view page since it's been inserted in a node page that is follow/index.

Any feedback will be appreciated.

Definite success! Thanks for

Slovak's picture

Definite success! Thanks for posting the solution!

thanks for the info, i added

mp's picture

thanks for the info, i added the argument
but i have also the module "Search 404", so when the site doesn´t exist the module starts a search. if you enter www.ding-dong.at/haus-means-house-in-german then you don´t get a 404, you get a search with these words.
is it better to deactivate the "Search 404" module?

this real-estate view has a "page", "block" and "feed"
you can find the page under the menu "immobilien", the block is at the bottom, the 5 newest real-estates and the feed is in the menu "newsfeed"

i hope your solution works and this site gets ranked :)

greets

There was a bug way back

criznach's picture

There was a bug way back when on search 404 because it returned 200 OK for every not found page. I haven't installed it since about 4.7, but but I think that's been fixed. I know I have a client using it.

You can double check using firebug or any utility that lets you view the request/response headers. Just be sure it's adding a 404 header. I don't think spiders are going to index a 404 page, but I could be wrong.

Heh

NikLP's picture

Yeah, that was fixed a loooong time ago. However, I don't recommend Search 404 unless you think you really need it, as there are alternatives.

I have an article which seems to be reasonably well thought of on the subject, here:

http://www.kinetasystems.com/blog/creating-custom-error-pages-in-drupal

Hope that helps!

Web Development in Nottingham, UK by Kineta Systems / Follow me on Twitter! @NikLP

ok, i deleted the

mp's picture

ok, i deleted the "search404" module and added "customerror" module ... i think this is a nice way, thanks

but, back to the main problem ... who does the view get no pagerank from google?
www.ding-dong.at --> pagerank: 4
www.ding-dong.at/immobilien --> pagerank: not ranked (this is a view2)

greets

This isn't going to be a

NikLP's picture

This isn't going to be a Views 2 issue, and isn't related to the original question. You should focus more on whether or not the view page is being indexed or not. If it's in the google index, then the issue is that the content is not well rated, rather than there being any "technical" problem.

I have some views pages on my site that are not ranked well, if at all, if that's any consolation. I would surmise that this is because they contain teasers to other nodes which have the full content on, but I'm half-guessing.

Web Development in Nottingham, UK by Kineta Systems / Follow me on Twitter! @NikLP

ah, ok ... that could be the

mp's picture

ah, ok ... that could be the reason ... maybe the detail-site is indexed and ranked

greets

my site is ranked :) -

mp's picture

my site is ranked :) - thanks a lot criznach
the next thing is the newsfeed on my site, should i make the same settings at arguments? it was ranked one day, but then i changed the url-alias and the pagerank was gone and now it doesn´t come back

greets

Thanks

RichieRich's picture

Criznach. Thanks so much. This may be one of the single most important threads that I've come across recently. I had no idea that all my views-generated pages were exhibiting such behaviour.

Thanks for the fix, Criznach.

brianmercer's picture

Thanks for the fix, Criznach.

new module

mikeytown2's picture

I got too many views to add this in by hand; created a module that does this a different way.
http://drupal.org/project/views404