Posted by mereandor on November 25, 2010 at 4:37pm
I plan to create a simple module that allows to change the read more link's title per node. So instead of the standard "Read more" you could write something like "Continue reading about how I've programmed my first drupal module …".
I would realize this by using a special CCK field to store the link title. Is there already an easier way to accomplish this? Thanks in advance for any suggestions.
Comments
Would this module work...?
There is already a module that makes a global change to the "Read More" link, and it looks like it is highly customizable - but not on a per-node basis like you'd have with a CCK field. Closest you could get to that would be using token replacement with this module.
http://drupal.org/project/ed_readmore
If this doesn't address what you're trying to do, please do elaborate! It might justify a new module, or possibly working with the existing module to add new functionality.
Node specific
As you said ed_readmore changes the readmore link globally.
I explicitly want to set the title on a per-node basis. So nodeX can have „sometext“ as title for the readmore link while nodeY has „anothertext“.
Perhaps it's best to contact the maintainers of ed_readmore first and see if they are willing to integrate per-node titles into their module. Thanks for the pointer!
Use field tokens...?
That module exposes the global set of tokens to be used in the "read more" link display - maybe a combination of a CCK text field and the ed_readmore module would do the trick? Each CCK field (especially the base field types that are bundled with CCK) usually expose their values as tokens for use.
You could try creating a CCK text field to hold your per-node "read more" link txt, make its default value simply "Read more" and use that field's token in the ed_readmore display text definition. Might save having to build a whole module by using components already available.
Tokens are probably one of the most over-looked features that can be added to Drupal, IMHO...
For Drupal 7: "Read More Link" module
It's mentioned on the ed_readmore module's own page, but this way it can be easier to find it directly from here: Read More Link (
read_more) is the appropriate module for Drupal 7. It's very easily customizable.