How to display only the years that have content in view filter? What I have done 


I have created a view.
I have added a content type to display .
I have added a filter to filter by node date content and have opted to display the post date as year in the filter.


What I want actually

I wanted to display only the years that have content. I am using Drupal 7.

Which are the ways to do this?
If you go to views page (/admin/structure/views), you will find a view "Archive", you can clone it and use it, it will be displaying content month+year using contextual filter "Content: Created year + month", as you want to display only year, use contextual filter ""Content: Created year" and remove "Content: Created year + month".

Screenshot for contextual filter.



Screenshot of output.



It will list all the years that have content added.

Update

What you can do is to create a block of the view, and place it on the page you want, and then when you will click on an year, you can have the content list accordingly on the same page.