<!DOCTYPE html>
<html xmlns:th="https://www.thymeleaf.org"
    th:replace="~{modules/layouts/layout :: layout(_head = null,_content = ~{::content},_title = ${title + ' - ' + site.title})}">

<th:block th:fragment="content">

    <div class="page_main uk-width-2-3@m">

        <th:block th:replace="~{modules/header}" />

        <div id="pjax-container">

            <div class="blog_list">
                <div class="blog_list_inner" uk-height-viewport="offset-top: true">

                    <div id="post_item" class="moment_list">
                        <!-- 作者姓名不为空才渲染朋友圈动态 -->
                        <div th:id="${'post-'+friend.metadata.name}"
                            class="loop_content p_item moment_item uk-animation-slide-bottom-small"
                            th:if="${friend.spec != null and not #strings.isEmpty(friend.spec.author)}"
                            th:with="postInfo = ${friend}, spec = ${friend.spec}">

                            <div class="p_item_inner">

                                <div class="list_user_meta">
                                    <div class="avatar">
                                        <img th:src="@{${spec.logo}}">
                                    </div>

                                    <div class="name">
                                        <div class="avatar_title">
                                            <a target="_blank" th:href="${spec.authorUrl}">
                                                [[${spec.author}]]
                                            </a>
                                        </div>

                                        <time itemprop="datePublished"
                                            th:datetime="${#dates.format(spec.pubDate, 'yyyy-MM-dd HH:mm')}">
                                            <th:block th:replace="~{modules/widgets/time :: time(${spec.pubDate})}">
                                            </th:block>
                                        </time>
                                    </div>
                                </div>

                                <div class="blog_content">
                                    <div class="entry-content">
                                        <div class="p_title moment-collapse-container">
                                            <a th:if="${not #strings.isEmpty(spec.postLink)}"
                                                target="_blank" th:href="${spec.postLink}">
                                                <div th:utext="${spec.description ?: '无内容'}"></div>
                                            </a>
                                            <div th:unless="${not #strings.isEmpty(spec.postLink)}"
                                                th:utext="${spec.description ?: '无内容'}"></div>
                                        </div>
                                        <div class="img_list img-dynamic-container">
                                            <div class="list_inner"
                                                th:with="imgRaw=${spec.imageFiles},isImgList=${not #strings.isEmpty(imgRaw)}"
                                                th:attr="num=${isImgList ? #arrays.length(imgRaw.split(',')) : 0}">
                                                <th:block th:if="${isImgList}">
                                                    <th:block th:with="imgArray=${imgRaw.split(',')}">
                                                        <th:block th:each="url : ${imgArray}"
                                                            th:with="cleanUrl=${#strings.trim(url)}">
                                                            <span class="fancybox mo_img"
                                                                th:if="${not #strings.isEmpty(cleanUrl)}"
                                                                th:href="|/upload/image-host/${cleanUrl}|"
                                                                th:data-fancybox="${'post-' + postInfo.metadata.name}">
                                                                <img class="lazy"
                                                                    src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="
                                                                    th:data-src="|/upload/image-host/${cleanUrl}|"
                                                                    alt="">
                                                            </span>
                                                        </th:block>
                                                    </th:block>
                                                </th:block>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>

                        <!-- 作者姓名为空：只展示404图片 -->
                        <div th:if="${friend.spec == null or #strings.isEmpty(friend.spec.author)}" style="text-align:center;padding:80px 0;">
                            <img src="/themes/theme-pix/assets/img/not-found.webp"style="max-width:400px;width:100%;">
                        </div>
                    </div>

                    <div id="comment_form_reset"></div>

                </div>
            </div>

        </div>

        <th:block th:replace="~{modules/footer-main}" />

    </div>
</th:block>

</html>