I have the following code in my template, which displays articles that have been tagged as 'related' through a relationship to the current article being viewed:
{exp:channel:entries channel="blog_entries" require_entry="yes" url_title="{segment_3}"}
{related_articles}
{if related_articles:count == 1}
<div id="related-articles" class="row">
<div class="container">
<div class="col span-12"><h3>Related Articles</h3></div>
{/if}
<div class="col span-4">
<h4><a href="/blog/article/{related_articles:url_title}">{related_articles:title}</a></h4>
</div>
{if related_articles:count == related_articles:total_count}
</div>
</div>
{/if}
{/related_articles}
{/exp:channel:entries}
This works fine for articles that have a relationship set up. My problem is that on articles that do not have any related articles set up via a relationship, the closing {/related_articles} tag is displayed in the page render. What am I doing wrong here?
EDIT: Here are some screenshots indicating the results I am getting.
Here is a test blog post that has a related article: https://i.stack.imgur.com/HTz35.png
And here is a test blog post that does not have a related article: https://i.stack.imgur.com/QRkv0.png