From: Raphaƫl Gertz <git@rapsys.eu> Date: Fri, 10 Nov 2023 12:17:32 +0000 (+0100) Subject: Update index templates X-Git-Tag: 0.1~15 X-Git-Url: https://git.rapsys.eu/blogbundle/commitdiff_plain/a4327fe8283484cae72cce64c682801da33cb6c0 Update index templates --- diff --git a/Resources/views/article/index.html.twig b/Resources/views/article/index.html.twig index 817a4e0..3f0abf6 100644 --- a/Resources/views/article/index.html.twig +++ b/Resources/views/article/index.html.twig @@ -1,29 +1,45 @@ -{% extends 'RapsysBlogBundle::body.html.twig' %} -{% block blog_title %}<h1><a href="{{ path('homepage') }}">{% trans %}Dev log{% endtrans %}</a></h1>{% endblock %} +{% extends '@RapsysBlog/_base.html.twig' %} {% block content %} -<section id="content"> - <h2><a href="{{ path('articles') }}">{% trans %}Articles list{% endtrans %}</a></h2> - {% for article in articles %} - <article> + <section id="content"> <header> - <h3><a href="{{ path('articles_article', {'_article': article.slug}) }}">{{article.title}}</a></h3> - <p> - <span>{% trans with {'%date%': article.created|localizeddate('full', 'short')} %}Published the %date%{% endtrans %}{% if article.created != article.updated %}{% trans with {'%date%': article.updated|localizeddate('short', 'short')} %}, edited the %date%{% endtrans %}{% endif %}</span> - {% if article.keywords %} - <span> - {% transchoice article.keywords|length %}{1} Keyword:|]1,Inf[ Keywords:{% endtranschoice %} - {% for slug, keyword in article.keywords %} - <a href="{{ path('keywords_keyword', {'_keyword': slug}) }}">{{ keyword }}</a> - {% endfor %} - </span> - {% endif %} - </p> + <h1><a href="{{ path('rapsys_blog_article') }}">{{ title }}</a></h1> + <p>{{ description }}</p> </header> - <p>{{article.description}}</p> - <nav> - <a href="{{ path('articles_article', {'_article': article.slug}) }}">{% trans %}Read more{% endtrans %}...</a> - </nav> - </article> - {% endfor %} -</section> + <section> + {% for article in articles %} + <article> + <header> + <h2><a href="{{ path('rapsys_blog_article_view', {'id': article.id, 'slug': article.slug}) }}">{{ article.title }}</a></h2> + </header> + <section> + <p>{{ article.description }}</p> + {% if article.keywords is defined and article.keywords %} + <nav> + {% for keyword in article.keywords %} + <a href="{{ path('rapsys_blog_keyword_view', {'id': keyword.id, 'slug': keyword.slug}) }}">{{ keyword.title }}</a> + {% endfor %} + </nav> + {% endif %} + </section> + <footer> + <nav> + <a href="{{ path('rapsys_blog_article_view', {'id': article.id, 'slug': article.slug}) }}">{% trans %}Read more{% endtrans %}...</a> + </nav> + </footer> + </article> + {% endfor %} + </section> + {% if articles_prev is defined or articles_next is defined %} + <footer> + <nav class="pager"> + {% if articles_prev is defined %} + <a href="{{ articles_prev }}" rel="prev">< {% trans %}Previous articles{% endtrans %}</a> + {% endif %} + {% if articles_next is defined %} + <a href="{{ articles_next }}" rel="next">{% trans %}Next articles{% endtrans %} ></a> + {% endif %} + </nav> + </footer> + {% endif %} + </section> {% endblock %} diff --git a/Resources/views/index.html.twig b/Resources/views/index.html.twig index 0036a4e..04c49e4 100644 --- a/Resources/views/index.html.twig +++ b/Resources/views/index.html.twig @@ -1,28 +1,45 @@ -{% extends 'RapsysBlogBundle::body.html.twig' %} +{% extends '@RapsysBlog/_base.html.twig' %} {% block content %} -<section id="content"> - <h2><a href="{{ path('articles') }}">{% trans %}Articles list{% endtrans %}</a></h2> - {% for article in articles %} - <article> + <section id="content"> <header> - <h3><a href="{{ path('articles_article', {'_article': article.slug}) }}">{{article.title}}</a></h3> - <p> - <span>{% trans with {'%date%': article.created|localizeddate('full', 'short')} %}Published the %date%{% endtrans %}{% if article.created != article.updated %}{% trans with {'%date%': article.updated|localizeddate('short', 'short')} %}, edited the %date%{% endtrans %}{% endif %}</span> - {% if article.keywords %} - <span> - {% transchoice article.keywords|length %}{1} Keyword:|]1,Inf[ Keywords:{% endtranschoice %} - {% for slug, keyword in article.keywords %} - <a href="{{ path('keywords_keyword', {'_keyword': slug}) }}">{{ keyword }}</a> - {% endfor %} - </span> - {% endif %} - </p> + <h1 id="title"><a href="{{ head.canonical }}">{{ title }}</a></h1> + <p>{{ description }}</p> </header> - <p>{{article.description}}</p> - <nav> - <a href="{{ path('articles_article', {'_article': article.slug}) }}">{% trans %}Read more{% endtrans %}...</a> - </nav> - </article> - {% endfor %} -</section> + <section> + {% for article in articles %} + <article> + <header> + <h2><a href="{{ path('rapsys_blog_article_view', {'id': article.id, 'slug': article.slug}) }}">{{ article.title }}</a></h2> + </header> + <section> + <p>{{ article.description }}</p> + {% if article.keywords is defined and article.keywords %} + <nav> + {% for keyword in article.keywords %} + <a href="{{ path('rapsys_blog_keyword_view', {'id': keyword.id, 'slug': keyword.slug}) }}">{{ keyword.title }}</a> + {% endfor %} + </nav> + {% endif %} + </section> + <footer> + <nav> + <a href="{{ path('rapsys_blog_article_view', {'id': article.id, 'slug': article.slug}) }}">{% trans %}Read more{% endtrans %}...</a> + </nav> + </footer> + </article> + {% endfor %} + </section> + {% if articles_prev is defined or articles_next is defined %} + <footer> + <nav class="pager"> + {% if articles_prev is defined %} + <a href="{{ articles_prev }}" rel="prev">< {% trans %}Previous articles{% endtrans %}</a> + {% endif %} + {% if articles_next is defined %} + <a href="{{ articles_next }}" rel="next">{% trans %}Next articles{% endtrans %} ></a> + {% endif %} + </nav> + </footer> + {% endif %} + </section> {% endblock %} diff --git a/Resources/views/keyword/index.html.twig b/Resources/views/keyword/index.html.twig index 9860b9c..b1a6ce4 100644 --- a/Resources/views/keyword/index.html.twig +++ b/Resources/views/keyword/index.html.twig @@ -1,28 +1,45 @@ -{% extends 'RapsysBlogBundle::body.html.twig' %} -{% block blog_title %}<h1><a href="{{ path('homepage') }}">{% trans %}Dev log{% endtrans %}</a></h1>{% endblock %} +{% extends '@RapsysBlog/_base.html.twig' %} {% block content %} -<section id="content"> - <h2><a href="{{ path('keywords') }}">{% trans %}Keywords list{% endtrans %}</a></h2> - {% for keyword in keywords %} - <article> + <section id="content"> <header> - <h3><a href="{{ path('keywords_keyword', {'_keyword': keyword.slug}) }}">{{keyword.title}}</a></h3> - <p> - <span>{% trans with {'%date%': keyword.created|localizeddate('full', 'short')} %}Published the %date%{% endtrans %}{% if keyword.created != keyword.updated %}{% trans with {'%date%': keyword.updated|localizeddate('short', 'short')} %}, edited the %date%{% endtrans %}{% endif %}</span> - </p> + <h1><a href="{{ path('rapsys_blog_keyword') }}">{{ title }}</a></h1> + <p>{{ description }}</p> </header> - {% if keyword.articles %} - <p style="margin-bottom: 0">{% transchoice keyword.articles|length %}{1} Article:|]1,Inf[ Articles:{% endtranschoice %}</p> - <ul> - {% for slug, article in keyword.articles %} - <li><a href="{{ path('articles_article', {'_article': slug}) }}">{{ article }}</a></li> - {% endfor %} - </ul> + <section> + {% for keyword in keywords %} + <article> + <header> + <h2><a href="{{ path('rapsys_blog_keyword_view', {'id': keyword.id, 'slug': keyword.slug}) }}">{{ keyword.title }}</a></h2> + </header> + <section> + <p>{{ keyword.description }}</p> + {#{% if article.keywords is defined and article.keywords %} + <nav> + {% for keyword in article.keywords %} + <a href="{{ path('rapsys_blog_keyword_view', {'id': keyword.id, 'slug': keyword.slug}) }}">{{ keyword.title }}</a> + {% endfor %} + </nav> + {% endif %}#} + </section> + <footer> + <nav> + <a href="{{ path('rapsys_blog_keyword_view', {'id': keyword.id, 'slug': keyword.slug}) }}">{% trans %}Read more{% endtrans %}...</a> + </nav> + </footer> + </article> + {% endfor %} + </section> + {% if keywords_prev is defined or keywords_next is defined %} + <footer> + <nav class="pager"> + {% if keywords_prev is defined %} + <a href="{{ keywords_prev }}" rel="prev">< {% trans %}Previous keywords{% endtrans %}</a> + {% endif %} + {% if keywords_next is defined %} + <a href="{{ keywords_next }}" rel="next">{% trans %}Next keywords{% endtrans %} ></a> + {% endif %} + </nav> + </footer> {% endif %} - <nav> - <a href="{{ path('keywords_keyword', {'_keyword': keyword.slug}) }}">{% trans %}Read more{% endtrans %}...</a> - </nav> - </article> - {% endfor %} -</section> + </section> {% endblock %}