2

I have a View block that displays all of the nodes written by an author on their profile. However, I'm having trouble with Views spitting out duplicate content.

For styling and functionality purposes, all of the fields are being outputted through an extra title field. I simply rewrote the output of the added title field, including tokens for all of my fields. I then set all of the fields (except for the rewritten title field) to "Display None", so that the fields were not duplicated.

Below is a screenshot of my current Views setup.

enter image description here

Here is a screenshot of the Views grid on the user profile. Ignore the missing images. I don't have all of the websites images synced to my local environment.

enter image description here

I tried using the "Distinct" option in the query settings, which eliminated most of the duplicates. However, Views continues to duplicate random content. Some content will have no duplicates, some content has multiple duplicates.

I've also tried using aggregation, but Views will not output anything when I turn aggregation on. I'd love for aggregation to be the solution, but I can't figure out how to get it to work.

3 Answers 3

4

I have came across this question in past looks like it is same as your Question: Filtered View gives duplicates

Referring that, I came to know you can use Views Distinct.

And you can follow this video tutorial: How To Remove Views Duplicates (Drupal Tutorial).

10
  • Using Views Distinct, I selected the Filter Repeats option for the Taxonomy term: Name field. It seemed to remove the duplicates, but now the number of items displayed on each page varies. For example, the first page is supposed to display 12, but with Views Distinct applied, it only displays 3 items.
    – Kellen
    Aug 19, 2016 at 13:09
  • @KellenLester Hey Kellen, I did not find the time to reply your comment, sorry for that, But I will reply after study that in some time. Thanks for patience.
    – CodeNext
    Aug 23, 2016 at 12:43
  • No problem. Just to give an update, I've tried eliminating relationships to see if I could narrow down the problem causer. I removed both of the author relationships, but the duplicates remained. I also tried removing the taxonomy relationship which did not solve the problem either.
    – Kellen
    Aug 23, 2016 at 13:13
  • I have one question, As per your views setting, you are using Format: Unformatted list, then how are getting the Grid view(12 items)? Are you doing this using CSS?
    – CodeNext
    Aug 23, 2016 at 13:16
  • The number of items outputted (per page) is dictated with the Pager settings. The actual grid design was created with CSS.
    – Kellen
    Aug 23, 2016 at 13:46
2

Using @CodeNext's advice, I rebuilt my view while monitoring the output on the user profile page. I discovered that the File: Name field was causing the duplicates. It never crossed my mind that it would have caused the duplicates. I was using that field to generate a image path for the Pinterest button. To avoid using this field, I downloaded the Image URL Formatter module. It was easy to generate an image path by adding another image field and selecting the URL formatter option.

1
  • 2
    Glad you solved the issue..
    – CodeNext
    Aug 23, 2016 at 22:57
1

I see you have 2 content author relationships. You should only need 1 of them. Remove the 1st one, highlighted in blue in your pic.

Now click on user: content authored, make sure you have checkmarked ☑ require relationship.

5
  • I was able to remove user: content authored, when I tried to remove content: author, my changes wouldn't save. I think that is because user: content authored is dependent on content: author. Regardless, using only content: author and selecting require relationship has not solved the problem.
    – Kellen
    Aug 19, 2016 at 12:52
  • @KellenLester try this, use Content: Author uid as relationship, and for contextual filter use Content: Author uid
    – No Sssweat
    Aug 19, 2016 at 13:12
  • Content: Author uid is not available as a relationship. Looks like Content: Author is the only option that would work.
    – Kellen
    Aug 19, 2016 at 13:34
  • @KellenLester Ooops sorry, I meant to say Content: Author for relationship and for contextual filter Content: Author uid
    – No Sssweat
    Aug 19, 2016 at 15:20
  • Ah... Yes, that's what I tried. It doesn't seem to change anything. Same issue is happening. Whatever the issue is, it definitely seems to be linked with the author. I though it may have been the taxonomy relationship. I tried removing it, but it had no effect.
    – Kellen
    Aug 19, 2016 at 15:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.