I have created custom views - with some rewrite results (Rewrite the output of this field), and there is error about a link not closed properly.
Code output by views looks like:
<div class="views-field views-field-view-node"><span class="field-content"><a href="http://www.mypage.com/news/test_news">READ MORE... <a href="http://www.mypage.com/news/test_news#comments">(2 comments)</a></a></span></div></div>
(notice - </a></a>
)
And it should looks like:
<div class="views-field views-field-view-node"><span class="field-content"><a href="http://www.mypage.com/news/test_news">READ MORE...</a> <a href="http://www.mypage.com/news/test_news#comments">(2 comments)<strong></a></strong></span></div></div>
Cause of this bug page is not validated (https://validator.w3.org/).
The thing is my browser is linking properly - so when you move over a READ MORE (in this particular case) link it will display correct link (www.mypage.com/news/test_news) as when you move over 2 comments link (www.mypage.com/news/test_news#comments). But looking at a page source and when editing a view you can see that it has wrong html order.
I have tried to use Content: Link, Content: Patch as a output of the field with no avail. If it's gonna help I can export the view to show how it's build.
Comments
Comment #1
pwiniacki CreditAttribution: pwiniacki commentedComment #2
kerios83 CreditAttribution: kerios83 commentedYes @pwiniacki Validator show me error on my page to.. I first thought that my fault of wrong views fields order but it seems that views is not closing a link properly. I'm gonna test it a little bit more and see if I'm able to fix this.
Comment #3
kelutrab11 CreditAttribution: kelutrab11 commentedI got this error to and after a while I get here. I can confirm that in a specific setup views is not properly validating.
Comment #4
pwiniacki CreditAttribution: pwiniacki commentedWhen you have 2 fields:
field-1 (link, path etc.)
field-2 (link, path etc.)
and you check "Rewrite the output of this field" for field-2 and put there field-1 also check "Strip HTML tags" (for field-2).
It will eliminate double link to the same content. HOWEVER when there are more complicated setups it probably won't save you from double link.
Comment #5
kerios83 CreditAttribution: kerios83 commented@pwiniacki thanks! I did manage to get rid of not validating code by rearrange the views fields and ->"Strip HTML tags".
Comment #6
pwiniacki CreditAttribution: pwiniacki commented