microformats2 https://planet.communia.org/ca ca Linkback module tagged alpha https://planet.communia.org/ca/content/linkback-module-tagged-alpha <!-- THEME DEBUG --> <!-- THEME HOOK: 'field' --> <!-- FILE NAME SUGGESTIONS: * field--node--title--blog--rss.html.twig * field--node--title--blog.html.twig x field--node--title.html.twig * field--node--blog.html.twig * field--title.html.twig * field--string.html.twig * field.html.twig --> <!-- BEGIN OUTPUT from 'themes/contrib/stable/templates/field/field--node--title.html.twig' --> <span>Linkback module tagged alpha</span> <!-- END OUTPUT from 'themes/contrib/stable/templates/field/field--node--title.html.twig' --> <!-- THEME DEBUG --> <!-- THEME HOOK: 'field' --> <!-- FILE NAME SUGGESTIONS: * field--node--field-image--blog--rss.html.twig * field--node--field-image--blog.html.twig * field--node--field-image.html.twig * field--node--blog.html.twig * field--field-image.html.twig * field--image.html.twig x field.html.twig --> <!-- BEGIN OUTPUT from 'themes/contrib/zurb_foundation/templates/field.html.twig' --> <div class="image field field--node-field-image field--name-field-image field--type-image field--label-hidden field__items"> <div class="field__item"> <!-- THEME DEBUG --> <!-- THEME HOOK: 'responsive_image_formatter' --> <!-- BEGIN OUTPUT from 'themes/contrib/stable/templates/field/responsive-image-formatter.html.twig' --> <a href="/sites/default/files/webmention-logo-380_0_0.png"> <!-- THEME DEBUG --> <!-- THEME HOOK: 'responsive_image' --> <!-- BEGIN OUTPUT from 'themes/contrib/stable/templates/field/responsive-image.html.twig' --> <!-- THEME DEBUG --> <!-- THEME HOOK: 'image' --> <!-- BEGIN OUTPUT from 'themes/contrib/stable/templates/field/image.html.twig' --> <img loading="eager" srcset="/sites/default/files/styles/max_325x325/public/webmention-logo-380_0_0.png?itok=WRUx7Pve 325w, /sites/default/files/styles/max_650x650/public/webmention-logo-380_0_0.png?itok=wJueH0N0 380w" sizes="(min-width: 1290px) 325px, (min-width: 851px) 25vw, (min-width: 560px) 50vw, 100vw" width="325" height="325" src="/sites/default/files/styles/max_325x325/public/webmention-logo-380_0_0.png?itok=WRUx7Pve" alt="" /> <!-- END OUTPUT from 'themes/contrib/stable/templates/field/image.html.twig' --> <!-- END OUTPUT from 'themes/contrib/stable/templates/field/responsive-image.html.twig' --> </a> <!-- END OUTPUT from 'themes/contrib/stable/templates/field/responsive-image-formatter.html.twig' --> </div> </div> <!-- END OUTPUT from 'themes/contrib/zurb_foundation/templates/field.html.twig' --> <!-- THEME DEBUG --> <!-- THEME HOOK: 'field' --> <!-- FILE NAME SUGGESTIONS: * field--node--uid--blog--rss.html.twig * field--node--uid--blog.html.twig x field--node--uid.html.twig * field--node--blog.html.twig * field--uid.html.twig * field--entity-reference.html.twig * field.html.twig --> <!-- BEGIN OUTPUT from 'themes/contrib/stable/templates/field/field--node--uid.html.twig' --> <span> <!-- THEME DEBUG --> <!-- THEME HOOK: 'username' --> <!-- BEGIN OUTPUT from 'themes/custom/planet_foundated/templates/username.html.twig' --> <a href="/user/1" class="visually-hidden p-author h-card" rel="author" title="kinta">kinta <img src="" alt="kinta" /> </a> <a title="View user profile." href="/ca/users/kinta">kinta</a> <!-- END OUTPUT from 'themes/custom/planet_foundated/templates/username.html.twig' --> </span> <!-- END OUTPUT from 'themes/contrib/stable/templates/field/field--node--uid.html.twig' --> <!-- THEME DEBUG --> <!-- THEME HOOK: 'field' --> <!-- FILE NAME SUGGESTIONS: * field--node--created--blog--rss.html.twig * field--node--created--blog.html.twig x field--node--created.html.twig * field--node--blog.html.twig * field--created.html.twig * field--created.html.twig * field.html.twig --> <!-- BEGIN OUTPUT from 'themes/contrib/stable/templates/field/field--node--created.html.twig' --> <span> <!-- THEME DEBUG --> <!-- THEME HOOK: 'time' --> <!-- BEGIN OUTPUT from 'themes/contrib/stable/templates/field/time.html.twig' --> <time datetime="2017-12-04T15:48:52+01:00" title="Monday, December 4, 2017 - 15:48">Mon, 12/04/2017 - 15:48</time> <!-- END OUTPUT from 'themes/contrib/stable/templates/field/time.html.twig' --> </span> <!-- END OUTPUT from 'themes/contrib/stable/templates/field/field--node--created.html.twig' --> <!-- THEME DEBUG --> <!-- THEME HOOK: 'field' --> <!-- FILE NAME SUGGESTIONS: * field--node--body--blog--rss.html.twig * field--node--body--blog.html.twig * field--node--body.html.twig * field--node--blog.html.twig * field--body.html.twig * field--text-with-summary.html.twig x field.html.twig --> <!-- BEGIN OUTPUT from 'themes/contrib/zurb_foundation/templates/field.html.twig' --> <div class="body field field--node-body field--name-body field--type-text-with-summary field--label-hidden field__item"><p>The <a href="https://www.drupal.org/project/linkback">Linkback module</a>(<a href="https://planet.communia.org/content/manual-de-linkback-drupal-8">background information</a>) for Drupal 8 has been tagged alpha today!  here a good intro about it written by <a href="http://hongpong.com/">HongPong</a>. We've done a lot of work to get there!</p> <blockquote> <p>Note for alpha1 release:</p> <p>We are proud to bring you the first alpha release of <strong>Linkback</strong>, an interesting suite of modules which can help integrate your website with the wider internet. Linkback provides the backend functionality to save both outgoing and incoming pings and webmentions involving remote sites.</p> <p>This first release focuses on a robust, spam resistant and fault tolerant approach to processing and storing Linkbacks as Drupal entities, which provides a standardized and efficient storage structure that can be easily queried and extended. (Anyone interested in improving the theming is invited to file an issue or share code with us :) More information about the functions in the Linkback suite is in Developer.md and the Readme.md files inside each child module.</p> <p>linkback_pingback creates the appropriate endpoints on your site to receive pingbacks from other sites (that is, someone on a WordPress site includes a link to your site and attempts to send a pingback; linkback_pingback receives the ping, scans the originating site URL to see if it a really existing anchor there, and if so, then it saves a new Linkback with the pingback handler attached to it.</p> <p>linkback_webmention provides much the same functionality for your site to send and receive Webmentions. (see other <a href="https://webmention.net/implementations/" rel="nofollow">Webmention implementations</a> - this module should interoperate with them). Services such as <a href="https://brid.gy/" rel="nofollow">brid.gy</a> can help connect proprietary content silos like Facebook and Twitter to your webmentions.</p> <p>Linkback has been cleverly structured to apply the best of Drupal 8 and Symfony architecture while reapplying many of the ideas from its predecessor <a href="https://drupal.org/project/vinculum" rel="nofollow">Vinculum</a> which provided similar services in Drupal 7. It should be feasible to extend Linkback to store other similar types of entities as records of intra-site communication.</p> <p>Thank you for trying Linkback - it is a product of several years of effort including bringing "<a href="https://indieweb.org/" rel="nofollow">indieweb</a>" principles and specifications into Drupal.</p> </blockquote></div> <!-- END OUTPUT from 'themes/contrib/zurb_foundation/templates/field.html.twig' --> <!-- THEME DEBUG --> <!-- THEME HOOK: 'field' --> <!-- FILE NAME SUGGESTIONS: * field--node--field-tags--blog--rss.html.twig * field--node--field-tags--blog.html.twig * field--node--field-tags.html.twig * field--node--blog.html.twig * field--field-tags.html.twig * field--entity-reference.html.twig x field.html.twig --> <!-- BEGIN OUTPUT from 'themes/contrib/zurb_foundation/templates/field.html.twig' --> <div class="field field--node-field-tags field--name-field-tags field--type-entity-reference field--label-inline clearfix"> <div class="field-label">Tags</div> <div class="field__items"> <div class="field__item"><a href="/en/etiquetes/sil-hostil" hreflang="en">sil-hostil</a></div> <div class="field__item"><a href="/ca/etiquetes/webmentions" hreflang="ca">webmentions</a></div> <div class="field__item"><a href="/ca/etiquetes/linkback" hreflang="ca">linkback</a></div> <div class="field__item"><a href="/ca/etiquetes/semantica" hreflang="ca">semantica</a></div> <div class="field__item"><a href="/ca/etiquetes/rdf" hreflang="ca">rdf</a></div> <div class="field__item"><a href="/ca/etiquetes/microformats2" hreflang="ca">microformats2</a></div> <div class="field__item"><a href="/en/etiquetes/pingbacks" hreflang="en">pingbacks</a></div> <div class="field__item"><a href="/ca/etiquetes/drupal-8" hreflang="ca">Drupal 8</a></div> <div class="field__item"><a href="/ca/etiquetes/drupal" hreflang="ca">Drupal</a></div> </div> </div> <!-- END OUTPUT from 'themes/contrib/zurb_foundation/templates/field.html.twig' --> <!-- THEME DEBUG --> <!-- THEME HOOK: 'links__node' --> <!-- FILE NAME SUGGESTIONS: * links--node.html.twig * links--node.html.twig x links.html.twig --> <!-- BEGIN OUTPUT from 'themes/custom/planet_foundated/templates/links.html.twig' --> <!-- END OUTPUT from 'themes/custom/planet_foundated/templates/links.html.twig' --> Mon, 04 Dec 2017 14:48:52 +0000 kinta 6374 at https://planet.communia.org https://planet.communia.org/ca/content/linkback-module-tagged-alpha#comments Manual de Linkback per drupal 8 https://planet.communia.org/ca/content/manual-de-linkback-drupal-8 <!-- THEME DEBUG --> <!-- THEME HOOK: 'field' --> <!-- FILE NAME SUGGESTIONS: * field--node--title--blog--rss.html.twig * field--node--title--blog.html.twig x field--node--title.html.twig * field--node--blog.html.twig * field--title.html.twig * field--string.html.twig * field.html.twig --> <!-- BEGIN OUTPUT from 'themes/contrib/stable/templates/field/field--node--title.html.twig' --> <span>Manual de Linkback per drupal 8</span> <!-- END OUTPUT from 'themes/contrib/stable/templates/field/field--node--title.html.twig' --> <!-- THEME DEBUG --> <!-- THEME HOOK: 'field' --> <!-- FILE NAME SUGGESTIONS: * field--node--field-image--blog--rss.html.twig * field--node--field-image--blog.html.twig * field--node--field-image.html.twig * field--node--blog.html.twig * field--field-image.html.twig * field--image.html.twig x field.html.twig --> <!-- BEGIN OUTPUT from 'themes/contrib/zurb_foundation/templates/field.html.twig' --> <div class="image field field--node-field-image field--name-field-image field--type-image field--label-hidden field__items"> <div class="field__item"> <!-- THEME DEBUG --> <!-- THEME HOOK: 'responsive_image_formatter' --> <!-- BEGIN OUTPUT from 'themes/contrib/stable/templates/field/responsive-image-formatter.html.twig' --> <a href="/sites/default/files/webmention-logo-380_0.png"> <!-- THEME DEBUG --> <!-- THEME HOOK: 'responsive_image' --> <!-- BEGIN OUTPUT from 'themes/contrib/stable/templates/field/responsive-image.html.twig' --> <!-- THEME DEBUG --> <!-- THEME HOOK: 'image' --> <!-- BEGIN OUTPUT from 'themes/contrib/stable/templates/field/image.html.twig' --> <img loading="eager" srcset="/sites/default/files/styles/max_325x325/public/webmention-logo-380_0.png?itok=qBkStNvE 325w, /sites/default/files/styles/max_650x650/public/webmention-logo-380_0.png?itok=SU0ngvBJ 380w" sizes="(min-width: 1290px) 325px, (min-width: 851px) 25vw, (min-width: 560px) 50vw, 100vw" width="325" height="325" src="/sites/default/files/styles/max_325x325/public/webmention-logo-380_0.png?itok=qBkStNvE" alt="" title="webmentions" /> <!-- END OUTPUT from 'themes/contrib/stable/templates/field/image.html.twig' --> <!-- END OUTPUT from 'themes/contrib/stable/templates/field/responsive-image.html.twig' --> </a> <!-- END OUTPUT from 'themes/contrib/stable/templates/field/responsive-image-formatter.html.twig' --> </div> </div> <!-- END OUTPUT from 'themes/contrib/zurb_foundation/templates/field.html.twig' --> <!-- THEME DEBUG --> <!-- THEME HOOK: 'field' --> <!-- FILE NAME SUGGESTIONS: * field--node--uid--blog--rss.html.twig * field--node--uid--blog.html.twig x field--node--uid.html.twig * field--node--blog.html.twig * field--uid.html.twig * field--entity-reference.html.twig * field.html.twig --> <!-- BEGIN OUTPUT from 'themes/contrib/stable/templates/field/field--node--uid.html.twig' --> <span> <!-- THEME DEBUG --> <!-- THEME HOOK: 'username' --> <!-- BEGIN OUTPUT from 'themes/custom/planet_foundated/templates/username.html.twig' --> <a href="/user/1" class="visually-hidden p-author h-card" rel="author" title="kinta">kinta <img src="" alt="kinta" /> </a> <a title="View user profile." href="/ca/users/kinta">kinta</a> <!-- END OUTPUT from 'themes/custom/planet_foundated/templates/username.html.twig' --> </span> <!-- END OUTPUT from 'themes/contrib/stable/templates/field/field--node--uid.html.twig' --> <!-- THEME DEBUG --> <!-- THEME HOOK: 'field' --> <!-- FILE NAME SUGGESTIONS: * field--node--created--blog--rss.html.twig * field--node--created--blog.html.twig x field--node--created.html.twig * field--node--blog.html.twig * field--created.html.twig * field--created.html.twig * field.html.twig --> <!-- BEGIN OUTPUT from 'themes/contrib/stable/templates/field/field--node--created.html.twig' --> <span> <!-- THEME DEBUG --> <!-- THEME HOOK: 'time' --> <!-- BEGIN OUTPUT from 'themes/contrib/stable/templates/field/time.html.twig' --> <time datetime="2017-05-02T00:33:32+02:00" title="Tuesday, May 2, 2017 - 00:33">Tue, 05/02/2017 - 00:33</time> <!-- END OUTPUT from 'themes/contrib/stable/templates/field/time.html.twig' --> </span> <!-- END OUTPUT from 'themes/contrib/stable/templates/field/field--node--created.html.twig' --> <!-- THEME DEBUG --> <!-- THEME HOOK: 'field' --> <!-- FILE NAME SUGGESTIONS: * field--node--body--blog--rss.html.twig * field--node--body--blog.html.twig * field--node--body.html.twig * field--node--blog.html.twig * field--body.html.twig * field--text-with-summary.html.twig x field.html.twig --> <!-- BEGIN OUTPUT from 'themes/contrib/zurb_foundation/templates/field.html.twig' --> <div class="body field field--node-body field--name-body field--type-text-with-summary field--label-hidden field__item"><p><strong>¡¡Aquesta entrada té un contingut amb llenguatge tècnic, sobre com instal·lar i desenvolupar un blog federable-federat dins la blogosfera</strong>!!</p> <h2>Instal·lació i configuració</h2> <p>Avís: el mòdul <a href="https://www.drupal.org/project/linkback">linkback</a> està en desenvolupament, i tot i que hi ha una versió en dev, que sigui en dev significa que to el que explico a continuació és susceptible a canvis.</p> <p>Descarrega el módul de linkbacks i activa linkback_pingback i linkback webmention. El mòdul linkback s'activarà com a dependència. Com que té dependències d'algunes llibreries via composer, s'haurà de modificar el composer.json de l'arrel, això s'haurà de fer cada cop que s'actualitzi el core:</p> <ul><li> <p>Activar el repo de github per la lib de microformats/test , dependència de mf2:</p> <ul><li> <pre> composer config repositories.1 vcs https://github.com/microformats/tests</pre></li> </ul></li> <li> <p>Activar la llibreria de mf2:</p> <ul><li> <pre> composer require mf2/mf2:dev-master</pre></li> </ul></li> <li> <p>Activar el client de webmention :</p> <ul><li> <pre> composer require indieweb/mention-client:dev-master</pre></li> </ul></li> <li> <p>Afegim el camp linkbacks al tipus de contingut que vulguem (de moment només es pot associar a entitats de tipus node [contingut]). Amb això ja tindrem la base.</p> </li> <li> <p>Hi han poques coses a configurar: si vols processar els linkbacks rebuts o enviats via cron o manualment, per llocs en producció més val confiar en el cron. Arribats a aquest punt quan rebem pingbacks/webmentions la nostra web ho porcessarà.</p> </li> <li> <p>Tot i això podem treure més suc de les relacions de web a web i dotar d'una semàntica bàsica el nostre site, podem triar microformats2 o rdf. Tot i que amb RDF podrem construir descripcions més acurades, com a punt de partida i tenint en compte que volem tenir un blog pel segle XXI amb microformats ja en tindrem prou. En una propera entrada de blog ja especificaré com es podria fer per dotar de descriptors rdf el nostre site i adaptar el mòdul linkbacks per tal que processi rdf's més complexes.</p> </li> </ul><h2>Oferta microformats2</h2> <p>Pel que fa al processament de microformats2 el mòdul linkbacks ja té tot el que ha de tenir, fa servir la <a href="https://packagist.org/packages/mf2/mf2">llibreria mf2</a>. El que no tindrem preparat és l'oferta de microformats al nostre lloc web. Per fer-ho haurem de modificar una mica el tema que haguem escollit pel nostre drupal. En el nostre cas fem servir un subtema de <a href="http://foundation.zurb.com/">foundation 6</a>, però es pot aplicar al que vulguem. Hi han dos entitats que necessiten ser modificades:</p> <ul><li> <p>El tipus de contingut que fem servir per crear entrades de blog. Normalment article o blog_entry.</p> </li> <li> <p>L'usuari. Això es configura al directori themes/nomdeltema/nomdeltema.theme i s'afegeixen les plantilles pertinents al directori themes/nomdeltema/templates/.</p> </li> </ul><h3>Theming del tipus de contingut</h3> <p>Hi han algunes aplicacions globals: e-content pel que fa a body i p-name pel que fa a títols. Així doncs en tots els camps on s'utilitzi aquests camps afegirem la classe corresponent. Al fitxer nomdeltema.theme:</p> <pre> /** * Implements template_preprocess_field(). */ function planet_founding_preprocess_field(&amp;$variables) { $element = $variables['element']; switch($element['#field_name']){ case 'body': $apply_mf = "e-content"; break; case 'title': $apply_mf = "p-name"; break; } if (!empty($apply_mf)){ $variables['attributes']['class'][] = $apply_mf; $variables['items'][0]['content']['#options']['attributes']['class'][] = $apply_mf; } }</pre><p>Un cop fet això podem modificar les plantilles per tal que s'afegeixin algunes classes i per adaptar l'estructura del DOM. A node.html.twig:</p> <pre> /** * El tag de html 'article' es descriu com a: h-entry. * * @todo Remove the id attribute (or make it a class), because if that gets * rendered twice on a page this is invalid CSS for example: two lists * in different view modes. * * @ingroup themeable */ #} {# !MF2 Afegim la descripció de h-entry a l'etiquta article #} &lt;article id="node-{{ node.id }}" {{ attributes.addClass('h-entry') }} &gt; {# !MF2 Afegim el link a la url del node amb text buit i la propietat u-url #} &lt;a class="u-url" href="{{ url }}"&gt;&lt;/a&gt; {{ title_prefix }} {% if teaser %} {# !MF2 En cas de teaser afegir la propietat p-name al títol#} &lt;h1{{ title_attributes.addClass('teaser').addClass('p-name') }}&gt; &lt;a href="{{ url }}" rel="bookmark"&gt;{{ label }}&lt;/a&gt; &lt;/h1&gt; {% elseif not page %} &lt;h2{{ title_attributes }}&gt; {# !MF2 En cas que no sigui teaser i tampoc pàgina completa afegir la propietat p-name al títol #} &lt;a href="{{ url }}" rel="bookmark" class="p-name" &gt;{{ label }}&lt;/a&gt; &lt;/h2&gt; {% elseif page %} {# !MF2 En cas que sigui pàgina completa afegir la propietat p-name al títol #} &lt;span class="hidden p-name"&gt;{{ label }}&lt;/span&gt; {% endif %} {{ title_suffix }} {% if display_submitted %} &lt;small&gt; &lt;p&gt; &lt;div class="posted row"&gt; &lt;div class="columns shrink align-self-middle"&gt; &lt;div class="float-left"&gt; {{ author_picture }} &lt;/div&gt; &lt;div{{ author_attributes.addClass('float-left').addClass('submitted') }}&gt; {# !MF2 Afegim la propietat de data del post dt-published #} {% trans %}Submitted by {{ author_name }} on &lt;time class="dt-published"&gt;{{ date }}&lt;/time&gt;{% endtrans %} {{ metadata }} &lt;/div&gt; {% if content.field_tags|length &gt; 2 and not is_front %} &lt;div class="tags fi-pricetag-multiple"&gt; {{ content.field_tags }} &lt;/div&gt; {% endif %} &lt;/div&gt; &lt;/div&gt; &lt;/p&gt; &lt;/small&gt; {% endif %} {# We hide the comments and links now so that we can render them later. #} &lt;div{{ content_attributes }}&gt; {# En cas que fem servir un tipus de comentari diferent per cada tipus de contingut , Amaguem els comentaris associats al tipus de contingut per poder-lo mostrar després #} {{ content|without('comment','comment_node_blog', 'links', 'field_tags') }} &lt;/div&gt; {{ content.links }} {{ content.comment }} &lt;/article&gt; &lt;hr class="superspace"&gt; </pre><h3>Theming de l'usuari</h3> <p>Pel que fa a l'usuari s'ha d'afegir microformats a l'username insertat a dins el tipus de contingut(modificant la plantilla username), i també a la pròpia pàgina de l'usuari(full). A la pàgina pròpia de l'usuari també afegirem la variable view_mode per tal de poder treure etiquetes només en cas que es mostri l'usuari amb el display 'full'.</p> <p>Haurem d'afegir les propietats de l'usuari:</p> <p>- url</p> <p>- nom d'usuari</p> <p>- thumbnail</p> <p>Amb una estructura(especificada a <a href="http://microformats.org/wiki/microformats-2">http://microformats.org/wiki/microformats-2</a>) similar a: <a href="http://microformats.org/wiki/microformats-2">http://microformats.org/wiki/microformats-2</a> :</p> <pre> &lt;a class="h-card" href="http://url_de_l_usuari"&gt; &lt;img alt="nom de l'autor" src="urldelaimatge.jpg" /&gt; &lt;/a&gt;</pre><p>Pel que fa a <b>thumbnail</b> afegirem la variable userthumb als dos llocs per disposar de la url a la imatge de l'avatar sencera, tant des del node com des de l'usuari. A nomdeltema.theme:</p> <pre> /** * Implements template_preprocess_username(). */ function planet_founding_preprocess_username(&amp;$variables){ if (!$variables['account']-&gt;user_picture-&gt;isEmpty()) { $fid = $variables['account']-&gt;user_picture-&gt;first()-&gt;target_id; $file = \Drupal\file\Entity\File::load($fid); $variables['user_thumb'] = file_create_url($file-&gt;getFileUri()); } } /** * Implements template_preprocess_user * * Add template suggestions and classes */ function planet_founding_preprocess_user(&amp;$variables) { if (!$variables['user']-&gt;user_picture-&gt;isEmpty()) { $variables['user_thumb'] = file_create_url($variables['user']-&gt;user_picture-&gt;entity-&gt;getFileUri()); } $variables['view_mode'] = $variables['elements']['#view_mode']; }</pre><p>Pel que fa a l'estructura del <b>dom username</b> dins cada entrada de blog es mostrarà amb la plantilla username.html.twig:</p> <pre> {# /** * @file * Theme override for displaying a username. * * Available variables: * - account: The full account information for the user. * - name: The user's name, sanitized. * - extra: Additional text to append to the user's name, sanitized. * - link_path: The path or URL of the user's profile page, home page, * or other desired page to link to for more information about the user. * - link_options: Options to set on the \Drupal\Core\Url object if linking the * user's name to the user's page. * - attributes: HTML attributes for the containing element. * * @see template_preprocess_username() * - user_thumb: the thumbnail */ #} {% if link_path -%} &lt;a href="/{{ link_path }}" class="visually-hidden p-author h-card" rel="author" title="{{ name }}"&gt;{{ name }} &lt;img src="{{ user_thumb }}" alt="{{ name }}" /&gt; &lt;/a&gt; &lt;a{{ attributes }}&gt;{{ name }}{{ extra }}&lt;/a&gt; {%- else -%} &lt;span{{ attributes }}&gt;{{ name }}{{ extra }}&lt;/span&gt; {%- endif -%} </pre><p>Pel que fa al display de <b>l'usuari sencer</b> modificarem la plantilla user.html.twig afegirem una estructura similar a:</p> <pre> + * + * - view_mode: the rendered view mode string. */ #} -&lt;article{{ attributes }}&gt; +&lt;article{{ attributes.addClass('h-card') }}&gt; +{% if view_mode == "full" %} + &lt;a class="visually-hidden p-name u-url" href="user/{{ user.uid.value }}" rel="me" title=&gt;{{ user.name.value }}&lt;/a&gt; + &lt;img class="hidden u-photo" src="{{ user_thumb }}" /&gt; +{% endif %}</pre><p>  </p> <h3>Dotar de semàntica els links que afegim al cos de l'entrada de blog</h3> <p>Per tal de poder afegir semàntica als links que afegim via l'editor de text enriquit podem instal·lar el mòdul <a href="https://www.drupal.org/sandbox/kinta/2865999">editorsemanticlink</a> que ens permetrà dotar de semàntica a cada link a que afegim via l'editor ckeditor. (Configurar correctament a admin/config/content/formats/manage/basichtml o admin/config/content/formats/manage/fullhtml afegint atributs class i rel a l'etiqueta a) Amb això ja podrem afegir links semàntics al cos de text de les entrades de blog.</p> <h2>Consum de linkbacks</h2> <p>Cada cop que rebem un linkback s’anirà al lloc d’origen i s’intentarà fer un parsing de la metainformació del lloc que ens menciona, si té microformats2 o RDF crearà un array json que s’emmagatzemarà al camp metainfo del linkback. Si volem utilitzar aquesta metainformació (per exemple per fer llistats de linkbacks filtrables o agrupables), hauriem de mapejar camps del json a camps del linkback.</p> <p>Per fer-ho haurem d’anar a admin/structure/linkback/manage i afegir els camps que vulguem. El mapejarem anant a l’edició del field, i al camp de text afegirem la proietat de l’array json: per exemple si creem el camp autor, al mapeig hi posarem «author/name» per agafar la propietat:</p> <pre> { «autor» : {«name» : «alison»}, «url»: «http://myurl» }</pre><p>Si es vol agafar la propietat url, simplement es posa «url»</p> <p>Cada cop que es guardi processarà el mapeig i assignarà el valor.</p> <p>Pel mapeig hi ha més informació a: <a href="https://www.drupal.org/docs/8/modules/linkback/metainfo-mappinghttps://www.drupal.org/docs/8/modules/linkback/metainfo-mappinghttps://www.drupal.org/docs/8/modules/linkback/metainfo-mapping">https://www.drupal.org/docs/8/modules/linkback/metainfo-mapping</a></p> <h3>Mostrar linkbacks</h3> <p>Un cop fet això ja podrem rebre i enviar linkbacks semàntics i quedarà mostrar a cada entrada de blog un comptador i el llistat de comentaris.</p> <p>Per tenir-ho podem utilitzar <a href="https://www.drupal.org/sandbox/kinta/2873693">el módul Linkback semantic</a>. Que crea el camp semantic_type a l’entitat linkback i instal·la un bloc.</p> <p>Aquest es pot configurar perquè només es mostri als tipus de contingut que ens interessi i farà que quan rebem linkbacks i aquests siguin categoritzables semànticament, es pugui veure un comptador per tipus i un llistat de comentaris agrupats per tipus.</p> <p>També disposa d'una plantilla per tal de poder fer el theming corresponent. Si no convenç la llista de comentaris, es pot fer amb views.</p> </div> <!-- END OUTPUT from 'themes/contrib/zurb_foundation/templates/field.html.twig' --> <!-- THEME DEBUG --> <!-- THEME HOOK: 'field' --> <!-- FILE NAME SUGGESTIONS: * field--node--field-tags--blog--rss.html.twig * field--node--field-tags--blog.html.twig * field--node--field-tags.html.twig * field--node--blog.html.twig * field--field-tags.html.twig * field--entity-reference.html.twig x field.html.twig --> <!-- BEGIN OUTPUT from 'themes/contrib/zurb_foundation/templates/field.html.twig' --> <div class="field field--node-field-tags field--name-field-tags field--type-entity-reference field--label-inline clearfix"> <div class="field-label">Tags</div> <div class="field__items"> <div class="field__item"><a href="/en/etiquetes/sil-hostil" hreflang="en">sil-hostil</a></div> <div class="field__item"><a href="/ca/etiquetes/webmentions" hreflang="ca">webmentions</a></div> <div class="field__item"><a href="/ca/etiquetes/linkback" hreflang="ca">linkback</a></div> <div class="field__item"><a href="/ca/etiquetes/semantica" hreflang="ca">semantica</a></div> <div class="field__item"><a href="/ca/etiquetes/rdf" hreflang="ca">rdf</a></div> <div class="field__item"><a href="/ca/etiquetes/microformats2" hreflang="ca">microformats2</a></div> <div class="field__item"><a href="/en/etiquetes/pingbacks" hreflang="en">pingbacks</a></div> <div class="field__item"><a href="/ca/etiquetes/drupal-8" hreflang="ca">Drupal 8</a></div> <div class="field__item"><a href="/ca/etiquetes/drupal" hreflang="ca">Drupal</a></div> </div> </div> <!-- END OUTPUT from 'themes/contrib/zurb_foundation/templates/field.html.twig' --> <!-- THEME DEBUG --> <!-- THEME HOOK: 'links__node' --> <!-- FILE NAME SUGGESTIONS: * links--node.html.twig * links--node.html.twig x links.html.twig --> <!-- BEGIN OUTPUT from 'themes/custom/planet_foundated/templates/links.html.twig' --> <!-- END OUTPUT from 'themes/custom/planet_foundated/templates/links.html.twig' --> Mon, 01 May 2017 22:33:32 +0000 kinta 126 at https://planet.communia.org https://planet.communia.org/ca/content/manual-de-linkback-drupal-8#comments