<%inherit file="home.phtml"/>
<%block name="content">
<div align="center" style="padding-top:40px;min-height:90vh;">
<h2 class="title_post"></h2>
<article class="tpl_post">
    <header>
      <h1 class="blog_post_name"></h1>
      <p>${lang('cuchulublog', 'published', 'Published')}: <time pubdate="pubdate" class="date_post"></time></p>
    </header>
    <div class="content_post">
    </div>
    <footer>
      <p><a href="#" class="url_post" id="url_post">${lang('cuchulublog', 'permanent_link', 'Permanent link')}</a></p>
    </footer>
</article>
</div>
</%block>
<%block name="js_footer">
    <script>
    
        <%

        from paramecio2.libraries.i18n import I18n

        lang_default=I18n.default_lang

        %>        
        
        //http://localhost:5000/blog/2021/12/07/first-post/1#
        
        var lang_default="${lang_default}";
        
        $.ajax({
            url: "${url_for('blog_app.get_post', post_id=post_id)}",
            data: {},
            success: function (data) {
                
                post_name=JSON.parse(data.title)[lang_default];
                
                $('.blog_post_name').html(post_name);
                
                var date_post=data.date.replace(' 00:00:00', '').replace(/-/g, '/');
                    
                $('.date_post').html(date_post);
                
                $('.content_post').html(JSON.parse(data.text)[lang_default]);
                
                var url_post='/blog/'+date_post+'/'+data.slugify+'/'+${post_id};
                
                $('#url_post').attr('href', url_post);
                
                $('title').html(post_name);
                
            },
            dataType: 'json'
        });
    
    </script>
</%block>
