I'm trying to figure out how to use coldfusion custom tags but can't figure out why the html/text nested inside the custom tag renders twice.
TLDR
I'm simply trying to make a custom tag that can accepts two attributes and uses them in the output as well as integrating any html/text nested inside the custom tag
Example
<!--- root.cfm --->
<cf_sameDirTag id="Tag 1" class="Oranges">
<div>My Inner Content</div>
</cf_sameDirTag>
<!--- sameDirTag.cfm (this file is in same directory as root file) --->
<cfparam name="attributes.id" type="string" default="">
<cfparam name="attributes.class" type="string" default="">
<cfif thisTag.executionMode eq "start">
<!--- NOTE Start tag processing --->
<br>
<div>Start</div>
<cfoutput>
<div class="flex flex-col gap-2">
<div>ID: #attributes.id#</div>
<div>Class: #attributes.class#</div>
</div>
</cfoutput>
<cfelse>
<!--- NOTE End tag processing --->
<br>
<div>End</div>
<cfoutput>
<div class="flex flex-col gap-2">
<div>ID: #attributes.id#</div>
<div class="flex flex-row gap-2">GenContent: #thisTag.generatedContent#</div>
<div>Class: #attributes.class#</div>
</div>
</cfoutput>
</cfif>
It seems cold fusion custom tags process twice if they have an open and closing tag. This can result in the tag being run twice. So to get around this you need to add the thisTag.executionMode check as i've done. In this example I'm printing mostly the same content for both start and end tag for demonstrative purposes, but ideally I would comment out the code when execution mode = "start" so that way we only process once during the end tag which gives us access to thisTag.generatedContent which we can freely insert wherever we want in our code.
The problem
I'm running into is no matter what the content nested inside my custom tag seems to render just after the opening tag of my custom tag ends. This semi makes sense because in the code <div>My Inner Content</div> does appear just after the opening tag.
<cf_sameDirTag id="Tag 1" class="Oranges">
<div>My Inner Content</div>
</cf_sameDirTag>
However, it also makes no sense because what is the point of being able to use thisTag.generatedContent in the end tag if that content is going to be pasted once beforehand anyway without control to choose where it's output?
This is what my current code outputs, if I commented out all code when thisTag.executionMode="start" the part labeled "bad" would still appear which is my core issue.

It might be worth reading the docs: Executing custom tags. It explains it reasonably clearly, and it makes sense.
Here is a very cut down example to make it clearer:
Notes:
thisTag.generatedContent. On the whole one might want to grab that for further processing, but then clear it, replacing it with the actual output you want to emit. I think this is the bit yer not quite understanding.thisTag.generatedContentvalue and then just emit different text (as per my example), or just change thethisTag.generatedContentvalue, eg I could have done this:In this case the CF engine will emit that
thisTag.generatedContentvalue when the tag completes. It depends what yer doing as what the best approach is here.