Different card templates for new/review cards using conditional tags?

You can achieve this with the custom scheduler, although it’s a bit complicated. Here’s how you can do it:

( Note: In AnkiDroid, you may need to enable the New reviewer in the Developer options for this to work on the back of the card. I don’t own an iOS device, so I’m unsure if this works in AnkiMobile. )

Deck options → Custom scheduling

function getOriginalState(states) {
    let originalState = null;
    const current = states.current;
    if (current.hasOwnProperty("normal")) {
        originalState = current.normal;
    } else if (current.hasOwnProperty("filtered")) {
        originalState = current.filtered.rescheduling.originalState;
    }
    return originalState;
}

function getReviewState(states) {
    return ["new", "learning", "review", "relearning"].find((type) =>
        getOriginalState(states).hasOwnProperty(type)
    );
}

const reviewState = getReviewState(states);

// If the card is new, display elements with the "only-new-card" class on the front of the card
if (reviewState === "new") {
    document.querySelectorAll(".only-new-card").forEach((el) => el.hidden = false);
}

// Make the review state accessible from the card's back template
globalThis.cardReviewState = reviewState;

Front template

{{Front}}
<div class="only-new-card" hidden>
    <div>New Card</div>
    <div>{{field 01}}</div>
    <div>{{field 02}}</div>
</div>

Back template

{{Back}}
<div class="only-new-card" hidden>
    <div>New Card</div>
    <div>{{field 03}}</div>
    <div>{{field 04}}</div>
</div>

<script>
    if (globalThis.cardReviewState === "new") {
        document.querySelectorAll(".only-new-card").forEach((el) => (el.hidden = false));
    }
</script>

Related thread:

1 Like