In a view for nodes

FORMAT
Format:HTML list | Settings
Show:Fields | Settings

FIELDS
Content: Title
Content: Body

If I enabled "Add a read-more link if output is trimmed." in "REWRITE RESULTS" , the "read more" link at the end of body text doesn't link to the right url.

Comments

dawehner’s picture

Status: Active » Postponed (maintainer needs more info)

Did you filled out the more link path field?

shenzhuxi’s picture

The path should be a variable, so I think the default value should be the link to the entity (the node in may case).

dawehner’s picture

You know this is quite hard to define a default value, as you know views is not about nodes but also about general entities and more stuff. I'm wondering whether the $data['table']['entity type'] could be used.

esmerel’s picture

Status: Postponed (maintainer needs more info) » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

WriteCo’s picture

Ack! I made myself nutty with this same problem. Solution: In the view, add the field for content:path. Display it or don't display it. Rearrange the fields so that path field is above the trimmed content. Go back to the trimmed field. Replacement patterns now has a path. Use it as the (duh) path. I got a bad case of keyboard face from banging my head on the keyboard over this.

Not a bug. Just part of the Views learning curve. The instructions in Views for picking a path may need to be clearer and with more detail for some of us slower types.

Now I am having conflicts with the read more module that permits configuring the link, which is how I got to this problem in the first place. Whatev-

eXoSaX’s picture

WriteCo, thanks a lot for your solution. :)

Road Kill’s picture

You can use Content:path, exclude it from display, and use [path] as the "More link path" to get the aliased path to the content. Make sure Content:path is above the trimmed field or it wont work.

bransom’s picture

Not to sound ungrateful, but even the content:path solution is less than ideal, in that when used, the end-user bounces completely out of the view and over to the node. Wouldn't the desired behavior be to click on 'read more' and simply see the rest of the text in the same view? Is this feature available and I'm just missing on how?

konrad_u’s picture

Issue summary: View changes

Glad I found this - I was trying to accomplish this but got sidetracked by content link field instead of using content path [path].

#9 to accomplish that you would need to add full body, then upon clicking link (ie. 'read more') you could use some sort of trigger to show that full body

scott.browne’s picture

^^^ same here!

Content [path] works for me. I had to add content path as a new field and rearrange fields above body.

Strange how [title] usually applies urls in some instances with different fields but the add more link gets a little funny with it.

Thanks.
www.coverclubmedia.com

adamps’s picture

If you have the same problem with a view of taxonomy terms, then the solution is similar, but slightly different.

  • Add a hidden field: "Taxonomy term: Term ID (Term ID)"
  • Set the "more link path" to "taxonomy/term/[tid]"
  • If you have an alias, Drupal will convert the link to that value automatically
sbrenner02’s picture

#6 got me most of the way there but in D9 you have to use "Content: Link to Content" and make sure you have "output the URL as text" enabled within that field.