Internal nodes is a module that allows you to select content types that can not
be directly accessed by their URL (eg http://www.example.com/node/16).
When a user visits a node that is an internal node, they will simply get a
Drupal 404 error page. This will stop search engines indexing nodes that
shouldn't be viewed directly (eg web site banners) and so will help stop
duplicate content on your site.
Project Page: http://drupal.org/sandbox/mjpa/1136278
Git access: git clone --branch 7.x-1.x mjpa@git.drupal.org:sandbox/mjpa/1136278.git internal_nodes
Comments
Comment #1
clemens.tolboomModule file is missing
Please fix the reported issues. Don't forget to set status to needs review after committed to your sandbox project.
Powered by Dreditor (triage sandbox) and Triage transitions
Comment #2
mjpa commentedThe module file is there. It's in the 7.x-1.x branch (original post has the git clone command for it).
Comment #3
clemens.tolboomYou're right. The code is http://drupalcode.org/sandbox/mjpa/1136278.git/tree/refs/heads/7.x-1.x
You should use http://api.drupal.org/api/drupal/modules--user--user.module/function/use... I guess?
is equivalent with
right?
I don't get the logic of
hook_init is always fired right?
Comment #4
mjpa commentedRE: user_access() usage - correct, don't know what I was thinking doing it manually, thanks - code has been updated.
RE: hook_init() - yes it's always fired but it is fired *after* the _load() function is called when processing the menu. There are times when Drupal will call the _load() function later in the page (and so isn't a direct request) so having the global variable allows me to check if it was a real direct request or not. Without that check there, edit pages produce a PHP warning and the 'view' tab URL is broken.
Comment #5
mjpa commentedCouple of other changes based on a code review by someone on IRC - added a check_plain() for the checkbox values and changed the help text to work better for translating.
Comment #6
mrjeeves commentedi like the module, clean, not much bloat, and a nice admin message to remind of hidden content.
Comment #7
mjpa commentedAs I understand things, it's been reviewed / tested by 3 or 4 people now...
Comment #8
13rac1 commentedSorry. You can't set your own module to RTBC.
Comment #9
sreynen commentedLooks good to me.
Comment #10
13rac1 commentedHi! According to Joachim in http://drupal.org/node/1146410#comment-4545596 neither of our project applications can be "Fixed" until we determine the best method to handle the similar functionality of our modules. As you know, "There can be only one!" :D
My original purpose in creating Block direct view was to implement 301 Redirects and outbound URL rewrites to fix the Drupal search results for blocked nodes. I added 403, because it was a simple addition. It looks as though your motivation for Internal nodes was to return a 404 for blocked nodes. Normally 404 is returned when the data isn't available, but these nodes are technically available. Would 403s be a reasonable substitute?
I've looked through the Drupal core code, and realized there isn't a straightforward way to force a 404 for a valid node. Your replacement node_load() function works well. Could explain why 404 was implemented rather than 403?
Good idea with the node status messages! I implemented that plus a class on the node div today.
Hmm... Just realized, an issue with the use of 404; It will clutter the File Not Found logs if often used. Would make finding/correcting actual 404s more difficult.
Comment #11
mjpa commentedThe idea behind this module was to allow nodes to be created that, while obviously existing, don't exist at any URL so 404 is more appropriate. 403 to me would put the module in the role of a node access module which isn't what this is.
I did have a plan to add a redirect option where you could select a path to redirect to (per content type) which, for example, would list the nodes. So for example if you had a View listing 'news' but no actual 'news' pages by themselves, you would set them as internal nodes and redirect to the 'news' View. I was waiting for the module to get approved before I did this though to see if anyone was interested (i have no use case for it).
RE the logs, Drupal logs both access denied / page not found so either way 1 will get cluttered, but then if you're getting hits on internal nodes, you have something wrong - eg you're linking to them or they're indexed in search engines etc.
I've made a comment on your application issue page relating to your module (this isn't the place for comments on your module).
Comment #12
13rac1 commentedJust discovered, this node_load() replacement method causes PHP notices in core menu.inc for anonymous users:
The menu.inc code starting at 2360 is:
Perhaps menu_get_item_alter() could be implemented to fix? It might be possible to make menu_get_item() to return a workable $item?
Comment #13
mjpa commentedI can't get the php notices to appear for me, however notices are usually ignored on most setups.
Also, menu_get_item() from what I can tell returns FALSE for a 404 (ie when the _load() call returns FALSE) so if anything it's a core issue to fix
Comment #14
13rac1 commentedAs discussed, I implemented 404 in Block direct view using menu_get_item_alter(). More information at the Block direct view project application: http://drupal.org/node/1146410
Comment #15
sreynen commentedNow that mjpa is a maintainer on both projects, I've granted mjpa access to promote projects to full projects. I trust mjpa and eosrei can work out which project they both want to promote. Please do not promote both projects.
eosrei, now that mjpa can promote your project, I'm going to close your application. If you need to promote another project in the future, please open a new application and reference these so we can do it faster next time.
Thank you both for your patience with this process.