I am building a site where I have users, companies and content.
Currently my users are standard Craft users, and my companies and content are entries within a channel.
I have a field in my content called company name which is an asset field and lets me create a relationship between a piece of content and a company and now I want to create a comaopny page that lists all content "owned" by that company.
I have the below as a starting point which is listing all of my content but any help on what I'd need to do to tweak it so that it only displays content where company name is equal to the entry title (which is the company name)? Hopefully that makes some kind of sense!
Many thanks in advance!
{% set relatedEntries = craft.entries()
.companyName(':notempty:')
.all() %}
{% if relatedEntries|length %}
<ul>
{% for rel in relatedEntries %}
<li><a href="{{ rel.url }}">{{ rel.title }}</a></li>
{% endfor %}
</ul>
{% endif %}