Nodes/comfyui_gr85/Tag Injector Single
ComfyUI Node

Tag Injector Single

The simplest way to drop one value into a template

By veighnsche·Created 2 years ago·Updated 8 months ago· 1
Tag Injector Single
    • tagged_text
    • placeholders
    template__elements__
    tag_1
    tag_name_1elements

    Single is the smallest member of the pack's tag-injector family, and the README says exactly what it does: "injects a single tag into a template using placeholder names like __elements__." One placeholder, one value, no more moving parts than that - it's the node to start with if you're new to this pack's tag-injection idea, before working up to Duo (two placeholders), the base Tag Injector (three), or Large (ten).

    How it works. Write a template string containing one __placeholder__ marker - the default is literally just __elements__ on its own - and supply the substitution value through tag_1, named by tag_name_1 (default elements). The node finds __elements__ in the template and replaces it with whatever you fed tag_1. Embed it in a longer sentence - "a photo of __elements__ in golden hour light" - and only that one piece varies.

    Why you'd use this over just typing the value straight into a prompt string. The obvious case is when tag_1's value is itself coming from somewhere dynamic - a wildcard pick, a Seed Based Output Selector result, anything computed elsewhere in the graph - and you want it dropped into a fixed carrier sentence without rebuilding that sentence by hand every time. If your whole prompt is static text with nothing varying, you don't need this node at all; just type the prompt directly into CLIPTextEncode. And if you outgrow one placeholder, the upgrade path is right there in the same pack - Duo for two, the base Tag Injector for three, Large for ten - so there's no need to bolt a second Single node onto a template that's grown past one variable piece.

    Inputs and outputs. template (required, multiline, default "__elements__"). tag_1 (optional, multiline string) - the value to inject. tag_name_1 (optional string, default elements) - the placeholder name it targets. Outputs: tagged_text - the substituted result - and placeholders, undocumented beyond its name; treat it as a debug/status output rather than something you route further.

    Installing it. No dependencies, plain string substitution. Search "comfyui_gr85" in ComfyUI Manager, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/veighnsche/comfyui_gr85
    

    Restart ComfyUI.

    The one way this quietly fails. The __placeholder__ text in your template has to match tag_name_1 exactly, underscores and all. The default is already aligned (__elements__ matches elements), so it works untouched out of the box - but rename tag_name_1 to something else without also editing the template text, and the substitution just silently doesn't happen. Check tagged_text after your first run rather than assuming it worked; a literal __elements__ sitting in your final prompt is easy to miss if you're not looking for it, and CLIP will happily encode it as-is rather than complaining.

    CategoryGR85/Prompt

    Inputs (3)

    NameTypeDefaultDescription
    templateSTRING__elements__
    tag_1optSTRING
    tag_name_1optSTRINGelements

    Outputs (2)

    NameTypeDescription
    tagged_textSTRING
    placeholdersSTRING