]> git.ipfire.org Git - thirdparty/bulma.git/commitdiff
Add link element
authorJeremy Thomas <bbxdesign@gmail.com>
Tue, 10 Apr 2018 21:50:18 +0000 (22:50 +0100)
committerJeremy Thomas <bbxdesign@gmail.com>
Tue, 10 Apr 2018 21:50:18 +0000 (22:50 +0100)
docs/_includes/components/links.html
docs/_includes/elements/link.html [new file with mode: 0644]
docs/blog.html
docs/more.html

index 5e2faa964b479c399d7be36a1c240401fb372577..5af554040a06399d8c1f810ff4fa5d5f35a6d56d 100644 (file)
       {% assign thingy = link_id[0] %}
       {% assign link = site.data.links.by_id[thingy] %}
     {% endif %}
-    <a class="bd-link" href="{{ site.url }}{{ link.path }}">
-      <h2 class="bd-link-name">
-        <figure class="bd-link-figure">
-          {% if include.icons %}
-            <span class="bd-link-icon has-text-{{ link.color }}">
-              <i class="{% if link.icon_brand %}fab{% elsif link.icon_regular %}far{% else %}fas{% endif %} fa-{{ link.icon }}"></i>
-            </span>
-          {% else %}
-            <span class="bd-link-counter"></span>
-          {% endif %}
-        </figure>
-        {{ link.name }}
-      </h2>
-      <p class="bd-link-subtitle">
-        {{ link.subtitle }}
-      </p>
-    </a>
+    {% assign link_url = site.url | append: link.path %}
+    {%
+      include elements/link.html
+      url=link_url
+      color=link.color
+      icon_brand=link.icon_brand
+      icon_regular=link.icon_regular
+      icon=link.icon
+      name=link.name
+      subtitle=link.subtitle
+    %}
   {% endfor %}
 </nav>
diff --git a/docs/_includes/elements/link.html b/docs/_includes/elements/link.html
new file mode 100644 (file)
index 0000000..e491b7e
--- /dev/null
@@ -0,0 +1,17 @@
+<a class="bd-link" href="{{ include.url }}">
+  <h2 class="bd-link-name">
+    <figure class="bd-link-figure">
+      {% if include.icon %}
+        <span class="bd-link-icon has-text-{{ include.color }}">
+          <i class="{% if include.icon_brand %}fab{% elsif include.icon_regular %}far{% else %}fas{% endif %} fa-{{ include.icon }}"></i>
+        </span>
+      {% else %}
+        <span class="bd-link-counter"></span>
+      {% endif %}
+    </figure>
+    {{ include.name }}
+  </h2>
+  <p class="bd-link-subtitle">
+    {{ include.subtitle }}
+  </p>
+</a>
index 51243d1e7ca7b568e0abe730c5845986df2effae..f129d491ed2ad239b8903622b9a12813a2574ab6 100644 (file)
@@ -38,19 +38,17 @@ breadcrumb:
         <div class="bd-content">
           <div class="bd-links">
             {% for post in site.posts %}
-              <a class="bd-link bd-is-post" href="{{ post.url }}">
-                <h2 class="bd-link-name">
-                  <figure class="bd-link-figure">
-                    <span class="bd-link-icon has-text-{{ post.color }}">
-                      <i class="{% if post.icon_brand %}fab{% elsif post.icon_regular %}far{% else %}fas{% endif %} fa-{{ post.icon }}"></i>
-                    </span>
-                  </figure>
-                  {{ post.name }}
-                </h2>
-                <time class="bd-link-subtitle" datetime="{{ post.date | date_to_xmlschema }}">
-                  {{ post.date | date_to_string }}
-                </time>
-              </a>
+              {% assign subtitle = post.date | date_to_string %}
+              {%
+                include elements/link.html
+                url=post.url
+                color=post.color
+                icon_brand=post.icon_brand
+                icon_regular=post.icon_regular
+                icon=post.icon
+                name=post.name
+                subtitle=subtitle
+              %}
             {% endfor %}
           </div>
         </div>
index d42cd1f1530a2a03294383b9b25cf1ae74530016..097a9d00417b15f1a806d2b996ff1b19f27a8978 100644 (file)
@@ -33,19 +33,17 @@ breadcrumb:
           <div class="bd-links">
             {% for link_id in site.data.links.more %}
               {% assign link = site.data.links.by_id[link_id] %}
-              <a class="bd-link bd-is-post" href="{{ site.url }}{{ link.path }}">
-                <h2 class="bd-link-name">
-                  <figure class="bd-link-figure">
-                    <span class="bd-link-icon has-text-{{ link.color }}">
-                      <i class="{% if link.icon_brand %}fab{% elsif link.icon_regular %}far{% else %}fas{% endif %} fa-{{ link.icon }}"></i>
-                    </span>
-                  </figure>
-                  {{ link.name }}
-                </h2>
-                <p class="bd-link-subtitle">
-                  {{ link.subtitle }}
-                </p>
-              </a>
+              {% assign link_url = site.url | append: link.path %}
+              {%
+                include elements/link.html
+                url=link_url
+                color=link.color
+                icon_brand=link.icon_brand
+                icon_regular=link.icon_regular
+                icon=link.icon
+                name=link.name
+                subtitle=link.subtitle
+              %}
             {% endfor %}
           </div>
         </div>