We Rock Your Web in the Press!

How Can I Control Link Placement in Drupal?

Home Forums Tech Web Development How Can I Control Link Placement in Drupal?

Post a New Topic

This topic contains 31 replies, has 5 voices, and was last updated by  Alex Schenker 1 year, 4 months ago.

  • Author
    Posts
  • #11490

    I am trying to place my “read more” links on the front page of my Drupal site before “Add New Comment” – any tips on how to control placement of these links in Drupal?

  • #11492

    Alex Schenker
    Keymaster

    Getting Drupal’s links to line up like you want them is not always easy. By default, the “read more” link on the front page is placed last in the item of links, while “add new comment” is placed first. If you examine the page’s CSS, you’ll notice that comment_add is prepended by “first,” while “node_read_more” is prepended by “last.” I think it’s a lot more intuitive to place “read more” first, since I am likely to read the rest of the article before placing a comment. To change around the link placement, insert the following code snippet in your theme’s stylesheet:

    li.last.node_read_more { text-align: left } <br />
    li.first.comment_comments, li.first.comment_add { float: right }   

    If you have more links in your links section than simple “read more” and “add new comment,” (for example, “forward” or “print”), then you can apply these style changes to these declarations as well. For example, to move the blog links after “read more” as well, you would use:

    li.blog_usernames_blog

    Read More Link Inline And Immediately Following Teaser?
    What if you would rather have the “read more” link immediately following the teaser, and not in the links section at all?  This is a common approach used by many sites, and it is a very intuitive approach since as your eyes leave the last sentence of the teaser they immediately fall upon the “read more” link.  Drupal has a contributed module, Read More Tweak, that is for this purpose.  Note, however, that during testing we’ve found that the nodeteaser and excerpt modules conflict with the use of this module.  So if you are using either of these modules your inline “read more” links may not appear at all.

  • #11644

    Guest
    Participant

    Hi,
    I used for a long time this helpful module “Read More Tweak”… but I did not know that it was incompatible with the excerpt-module. However, later I tried out the excerpt module, as I was looking for a similar feauture. As I noticed the incompatibility with the read-more-tweak, I uninstalled the excerpt-module again.
    Unfortunately, since then the readmore-links disappear on *some* nodes (NOT on all but most nodes, while it does not matter, if the node was created in use with the excerpt-module or not). So I cannot get it back working… correctly :(

    Do you have perhaps an idea, how I could get the tweak-module back working? How can i now fix this conflict?

    • #11841

      Alex Schenker
      Keymaster

      Hi there,

      We’ve experienced the same problem with read more – that the links simply don’t appear for some nodes. We had either nodeteaser or excerpt installed so we assumed that was the problem. For now our solution is to use the CSS method above in lieu of the read more tweak module.

  • #11648

    Guest
    Participant

    How would the CSS be if I want different bg images to each link in the menu?

    Sherif

  • #11649

    Guest
    Participant

    Nice – I’ve been trying to get the read more placement to work for some time now. This is just the information I was looking for.

  • #11650

    akua.layla
    Member

    How would the css be if I want different bg images to each link in the menu?

    • #11651

      Alex Schenker
      Keymaster

      Hi Lara,

      You can generally add background to your menu images using the following CSS (in this example the menus are generated using Drupal’s Nice Menus module – you might need to adjust your CSS element accordingly):

      #block-nice_menus-1 a { background: #fff url(example.gif) no-repeat top center }

  • #11652

    Guest
    Participant

    Thanks a ton – I’ve been trying to find a way to get my “comment” links to appear in a way similar to WordPress for ages. Now I have the flexibility to place my read more links where I want them :)

  • #11653

    Guest
    Participant

    Thank you for helping me resolve Drupal’s strange “out of the box” link placement! If it’s an industry standard to have “read more” links, why would Drupal use such odd link placement to begin with?

  • #11654

    Guest
    Participant

    Good article, now my read more links finally look good! I was about to switch to WordPress. I realize that Drupal is a lot more powerful than some of the competing CMS systems out there (WordPress, Joomla), but if its user-friendliness doesn’t keep up, people won’t notice.

    • #11655

      Guest
      Participant

      YEAH you encompass my sentiment!!!!!!!!!!!!!!!!!!

  • #11656

    Guest
    Participant

    This works great, however I’m having an issue with the “read more” link in my RSS feeds. Specifically, they are appearing twice. Once in the text body (unclickable) and then again as a link. It’s not happening on all my sites, however, and I can’t seem to figure out what’s causing it? Any idea how to get rid of the text-only “read more” link?

  • #11657

    Guest
    Participant

    I’m also getting two read more links – one is clickable and one is not, however on some sites only one will show up, while on others both show up. Any ideas?

    • #11658

      Guest
      Participant

      I used for a long time this helpful module “Read More Tweak”… but I did not know that it was incompatible with the excerpt-module. However, later I tried out the excerpt module, as I was looking for a similar feature.

      As I noticed the incompatibility with the read-more-tweak, I uninstalled the excerpt-module again. Unfortunately, since then the readmore-links disappear on *some* nodes (NOT on all but most nodes, while it does not matter, if the node was created in use with the excerpt-module or not). So I cannot get it back to working correctly.

  • #11659

    Guest
    Participant

    Sigh, why can’t Drupal just be more user-friendly? I realize they’re getting closer and closer with each version, but the placement of read more links is just another example of how far they’re falling behind WordPress in terms of user friendliness.

    • #11660

      Guest
      Participant

      I prefer working with Joomla – the easiest most robust CMS out there. The admin panel is a breeze, article posting is super easy, and with all the modules like CB and Virtumart there is very little limit to what you can do in Joomla.

      • #11661

        Guest
        Participant

        And I prefer Drupal — a lot more power, yes, with more complexity but that’s the price to pay. Try to learn it well and then everything falls into place.

  • #11662

    Guest
    Participant

    Now that is what I call an excellent guide, thanks…

  • #11663

    Guest
    Participant

    Nice – I’ve been trying to get the read more placement to work for some time now.

  • #11664

    Guest
    Participant

    I used for a long time this helpful module “Read More Tweak”… but I did not know that it was incompatible with the excerpt-module. However, later I tried out the excerpt module, as I was looking for a similar feature.

    • #11665

      Guest
      Participant

      This is exactly what I’ve done, so I’m fine with this now I think.

  • #11666

    Guest
    Participant

    Sheesh, c’mon Drupal. How difficult is it to see that people want a read more link right after the content? Drupal’s default implementation of read more links is ridiculous – thank goodness there’s people willing to create an improvement on this feature!

  • #11667

    Guest
    Participant

    You’ve done great work. Link placement is always important so thanks for this.

  • #11668

    Guest
    Participant

    I like the approach you’ve used on this site – you’re able to click on the article heading as well as on “read more…” to read the rest of the article. I think that gives the user plenty of options to continue reading your content.

  • #11669

    Guest
    Participant

    We’ve experienced a similar problem with learn more – the fact that links simply don’t appear for those nodes. We had also nodeteaser or excerpt established so we assumed that has been the problem. For now, our option would be to use that CSS method above instead of the read a lot more tweak module. I used for a long period this helpful module “Read A lot more Tweak”.

    But used to not know whose was incompatible with all the excerpt-module. However, after I tried the excerpt module, as I used to be looking for an identical feature. As I observed the incompatibility with all the read-more-tweak, I uninstalled the excerpt-module once more.

  • #11670

    Guest
    Participant

    Thanks for your post I used the code revision and it works just fine.

  • #11671

    Guest
    Participant

    Well, that’s great, however what about additional options we’ve got here? Do you mind making one more post about all of them also? Many thanks!

  • #11672

    Guest
    Participant

    How do I display the “add new comment” heading ($content['links']['comment']['#links']['comment-add']) somewhere else on the page, ie. in node.tpl.php?

  • #11673

    Very nice! Thanks a lot.

  • #11646

    Guest
    Participant

    Hi again,
    Thanks for this quick reply… I’m sure it is the excerpt module (I never used nodeteaser) – but in my case deactivating/uninstalling the module does not help further.
    Well, nevertheless I tried to implement the snipplet above (even though it is only a temporary solution for me). It did not work at first (< br /> tag!?!), but finally I got the thought of it for adjusting the other details too (except that the other links are now completely unordered?). Thanks!
    If you hear of a better workaround or even a fix… please contact me…

    Apropos… sorry, I did not even give a hint (in the first comment) about who I am…
    hQuadrat

  • #11647

    Guest
    Participant

    Nice writing style. Looking forward to reading more from you.

You must be logged in to reply to this topic.