<th:block th:fragment="douban-item(doubanItem)" th:if="${doubanItem != null and doubanItem.spec != null}"
    th:with="spec = ${doubanItem.spec}, faves = ${doubanItem.faves}, score = ${faves == null ? spec.score : (not #strings.isEmpty(faves.score) ? faves.score : spec.score)}, isRead = ${faves != null and faves.status == 'done'}">

    <div th:id="${'post-' + doubanItem.metadata.name}"
        class="loop_content p_item moment_item douban_card_item uk-animation-slide-bottom-small">

        <div class="p_item_inner douban_card_inner">
            <div class="douban_text_col">
                <div class="douban_title_row">
                    <a th:if="${isRead and not #strings.isEmpty(spec.link)}"
                        class="douban_title_text"
                        th:href="${spec.link}"
                        th:text="${spec.name}">
                        豆瓣条目
                    </a>
                    <span th:unless="${isRead and not #strings.isEmpty(spec.link)}"
                        class="douban_title_text douban_title_text_plain"
                        th:text="${spec.name}">
                        豆瓣条目
                    </span>
                    <a class="douban_detail_link"
                        th:href="${'/books/' + doubanItem.metadata.name}"
                        aria-label="查看详情" title="查看详情">
                        详情
                    </a>
                </div>

                <div class="douban_media_col">
                    <span class="fancybox"
                        th:href="${#strings.isEmpty(spec.poster) ? '/themes/theme-pix/assets/img/banner-all.webp' : spec.poster}"
                        th:data-fancybox="${'douban-' + doubanItem.metadata.name}">
                        <img class="douban_poster_img"
                            th:src="${#strings.isEmpty(spec.poster) ? '/themes/theme-pix/assets/img/banner-all.webp' : spec.poster}"
                            th:alt="${spec.name}">
                    </span>
                </div>

                <div class="douban_sub_meta">
                    <time class="douban_time_text"
                        th:if="${faves != null and faves.createTime != null}"
                        th:datetime="${#dates.format(faves.createTime, 'yyyy-MM-dd HH:mm')}">
                        <span th:text="${#dates.format(faves.createTime, 'yyyy-MM-dd')}">2025-01-01</span>
                    </time>
                    <span class="douban_type_badge" th:text="${spec.type}">类型</span>
                    <span class="douban_score_badge"
                        th:if="${not #strings.isEmpty(score)}"
                        th:text="|${score}分|">评分</span>
                </div>

                <div class="douban_content_box">
                    <p class="douban_content_main"
                        th:text="${#strings.isEmpty(spec.cardSubtitle) ? '暂无简介' : spec.cardSubtitle}">
                        暂无简介
                    </p>
                    <p class="douban_content_meta">
                        <span th:if="${not #strings.isEmpty(spec.year)}" th:text="${spec.year}"></span>
                        <span th:if="${not #strings.isEmpty(spec.pubdate)}" th:text="${spec.pubdate}"></span>
                    </p>
                </div>
            </div>
        </div>
    </div>
</th:block>
