<article id="post-<?php the_ID(); ?>" <?php post_class('blog-template'); ?>>

    <?php
    $default_thumbnail_url = get_template_directory_uri() . '/assets/images/thumbnail.webp';
    
    if ( has_post_thumbnail() )  : ?>
        <div class="post-thumbnail">
            <a href="<?php the_permalink(); ?>">
                <?php the_post_thumbnail(); ?>
            </a>
        </div>
    <?php else: ?>
        <div class="post-thumbnail">
            <a href="<?php the_permalink(); ?>">
                <img src="<?php echo esc_url($default_thumbnail_url); ?>" alt="<?php esc_attr_e('Default Thumbnail', 'nexo'); ?>"/>
            </a>
        </div>
    <?php endif; ?>
    <section class="article__box">
        <div class="entry-category">
                <?php the_category(' '); ?>
            </div>

        <section class="entry-header">
            <h3 class="entry-title">
                <!-- <a href="<?php the_permalink(); ?>" rel="bookmark"><?php echo mb_substr(get_the_title(), 0, 40) . (strlen(get_the_title()) > 40 ? '...' : ''); ?></a> -->
                <a href="<?php the_permalink(); ?>" rel="bookmark"><?php echo esc_html(wp_trim_letters(get_the_title(), 40, '...')); ?></a>
            </h3>

        </section><!-- .entry-header -->

        <div class="entry-content">
            <p>
                <?php
                    $custom_excerpt = esc_html(wp_trim_letters(get_the_content(), 120, '...'));
                    echo $custom_excerpt;
                ?>
            </p>

        </div><!-- .entry-content -->


        <div class="entry-meta">
            <?php  echo  get_the_author() . ' - '. get_the_date(); ?>
        </div><!-- .entry-meta -->
    </section>
</article>
