Provide convenience function to filter at the theme layer
Godmode - October 16, 2007 - 12:47
| Project: | Nofollow List |
| Version: | 6.x-1.0 |
| Component: | User interface |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Description
I am using nofollowlist 5.x-1.1 on Drupal 5.2. As i understand, if i add sites to whitelist, all the rest of the sites not under whitelist should get a nofollow.
However its not working properly. Someone added a comment with a link, the site is not under whitelist but still didnt get nofollow added to it.
Can someone help?

#1
I, too, am unable to get any rel=nofollow to appear in comments that I post.
Perhaps someone can point me to some documentation, if some exists. My
searches came up empty.
The particulars:
Thanks for any help you can offer!
Jim Bernatowicz
#2
Hey guys,
I had the same problem and did a little digging. The one thing I didn't do is enable the Nofollowlist filter in the set up of the various Input types.
To install - enable the module on admin/build/modules, visit your admin/settings/filters and add this to the appropriate filters (in Drupal 5.x, that's Administrator > Site Configuration > Input Formats > pick the filter you want to add it to > configure and enable).
Hope that gets you working. Good idea if the module author added this to the description a little clearer so people like me get it clear in their heads :)
#3
Thanks for debugging and for providing constructive feedback!
Ever since it was first created this project page has stated
I just added a Installation Note in front of it to make it stand out more.
@godmode and @jbernat - can you confirm that this solves your problem as well? If so then that's good news.
#4
Not working here. Either blacklist or whitelist.
Using:
Drupal -> 5.2
nofollowlist -> 5.x-1.1
My activities for blacklist were:
look for readme -> none found
install into sites/all/modules
enable module
config module for blacklist and give it 4 test URLs
give [administer nofollowlist] to a role
add to all [Input Formats] defined
* all viewing done in different browser (Firefox) than one logged into site (Opera).
clear all cache tables
look at old post with existing blacklist URL -> nofollow not found
clear all cache tables
edit old post, add more blacklist URLs -> nofollow not found
clear all cache tables
create new post with multiple blacklist URLs -> nofollow not found
clear all cache tables
create new post with blacklist URLs in teaser -> nofollow not found on /node list
clear all cache tables
config module for whitelist, delete two URLs
-> nofollow found on custom sidebar block links
-> nofollow not found on regular menu items
-> nofollow not found on anything but custom sidebar block
Clear all cache tables, drink a beer, write up a bug report.
Testing for various combinations of URL paths and attributes, Testing Link formats were:
<A HREF="http://drupal.org/node/6261" TARGET="_blank">Drupal</A>
<A HREF="http://drupal.org/" TARGET="_blank">Drupal</A>
<A HREF="http://drupal.org/">Drupal</A>
<A HREF="http://en.wikipedia.org/wiki/Global_warming_conspiracy_theory" TARGET="_blank">Global Warming Consp</A>
<A HREF="http://en.wikipedia.org/">Global Warming Consp</A>
None ever picked up nofollow attribute in any configuration.
Sam
Admin, inet-design
Managed hosting for the Drupal Content Management System
#5
Title fix.
I knew I should have waited to drink that beer.
#6
Yes! This was the missing piece. Thanks for pointing that out.
Jim
#7
@sam-inet: thanks for the very detailed report.
What happens if you edit a piece of content (change it and re-save it) or create a new node. I know that this should have a similar effect to clearing all the cache tables, but maybe it is part of the key? Thanks.
#8
I can't reproduce this and I've had other people (guardian in irc) confirm that it works properly for them. So I'm closing it.
This module only impacts links that are passed through the filter system. It will only work if the content is sent through the filter a second time (Drupal caches this). To confirm whether it is working, create a new node with a test url in it.
I updated the project page to clarify where/how it works.
#9
Hi greggles,
I'm back!.!..... (sorry for never replying, I gave up on this for D5, but figured I'd give this a go for D6)
The problem hasn't gone away, and to refine the problem, it seems to be very specifically related to the "Homepage:" links left by a commenter. Load up your favorite nofollow highlighter and head to:
http://winetest.fermentedreviews.com/cycles_gladiator_2005_cabernet_sauv...
My whitelist is:
fermentedreviews.com
www.winegiques.com
http://www.winegiques.com
winegiques.com
And I've added Nofollow List to the Input format "Filtered HTML". Both that node and comment are input format "Filtered HTML."
As you'll see, the links in the body text and the comment body to "http://www.winegiques.com" come out okay, but the link in the "Submitted by Suenarita" gets wacked with a "nofollow."
So, since this seems to be a user error, can you point me to what I need to do to get the "Submitted by" field for comments to get whitelisted correctly?
Thanks,
Sam
Site Details:
Drupal 6.13
Nofollow List 6.x-1.0
#10
AHA!
The module can't ever work on things in the theme layer like that. See attached screenshots for more data...
It would be possible to filter that _at the theme layer_ but that would require code to be implemented by each site.
The best we can do in this module is to provide a convenience function to themers.
I don't plan to work on this but would accept a patch (ideally that included documentation).
#11
Well Puppy Poo!
That definitely explains why I thought NoFollow had a bug two years ago :( The number one reason the people I support need it are to whitelist commenter's homepages. Theory being, if a commenter leaves something relevant and valid, then they get a positive link.
I don't know the inner workings of this module, but I'll take a swipe at its functioning, so I can get a pointer from you as to how to patch it to do what I want. NoFollow under whitelist works something like this?
1) Every link everywhere gets nofollowed, then
2) Any content that gets filtered then gets the nofollow removed if it matches the whitelist?
And the fix would be something like:
- Adding an exposed hook (callable function) to the Nofollow module, so that passed strings get 'filtered.'
- Having the theme call the hook to pass all non-normally filtered elements to Nofollow to get 'filtered.'*
Which, and that might be grossly oversimplified, leads me to two thoughts, or maybe they're questions?
A) The new exposed function in Nofollow would only need to be 10 lines or so, as it would just be a wrapper for receiving the text, calling the exising Nofollow function(s) that does the filtering already, and returning the filtered text?
B) The second thought is to go "big." Instead of adding the Nofollow filter to input formats, is there someplace in the top most part of a theme set where the entire completed output (e.g. the whole completed webpage which currently goes to the user's browser) can be sent to the new exposed function in Nofollow? That way everything goes through Nofollow's whitelist filtering, not just bits and pieces?
If A) and B) are doable and you can point me to where B) would be in a theme, I'll gladly do the patch for this (and I'll even do the documentation :)
Thanks greggles,
Sam
*Actually, I'd probably be lazy and just wrap the entire comment.tpl.php, node.tpl.php, block.tpl.php, etc. in a call to Nofollow. Saves on trying to track down every individual element that might need filtering...
#12
Ehh, reopened it, so you'd see my last comment :)
Feel free to close this as, what I'm looking for is legitimately a feature request. Which I'll gladly submit in the proper place upon confirmation that A) and B) (or even *) are workable.
Best,
Sam
#13
I think A is possible with very few lines of code. We can re-purpose this issue as a feature request which works fine.
#14
Thanks greggles,
Hope you had a nice weekend. I'm currently digging through the Theme handbooks to understand how/where to make the proper hooks.* As the more I think of it, the more I like option B).
If you have time and A) isn't more than a few lines of code, can you do A)? If not, I'll dig through the Nofollow module after I get done with understanding D6 theming.
Best,
Sam
* Well, beyond just wrapping "print $submitted;" type statements.
** Beyond the scope of this request, I think I'll look into enhancing Nofollow into adding [target="_blank"] for external link references.
EDIT:
Well, this is becoming a pain, and I'm adding this as notes for myself on what I've already tried.
Doesn't work:
- Module "Submitted By" http://drupal.org/project/submitted_by , as it doesn't modify comment submitted by fields. (Nor does the production version of Token have Hour or Minute formats, so can't recreate the existing comment submitted by format.)
- Editing comment.tpl.php to change "print $submitted;" to "print 'Submitted by ' . theme('username', $comment) . ' on ' . format_date($comment->timestamp, 'custom', 'D, Y-m-d g:i' . ".");"