Skip to content

Commit

Permalink
Add gallery category under blogs (kubevirt#474)
Browse files Browse the repository at this point in the history
Signed-off-by: Pablo Iranzo Gómez <Pablo.Iranzo@gmail.com>
  • Loading branch information
iranzo authored and mazzystr committed Jun 4, 2020
1 parent aee604d commit d9ff777
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 1 deletion.
3 changes: 3 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ collections:
labs:
output: true
permalink: /:collection/:path
galleries:
output: true
permalink: /:collection/:path

plugins: [jekyll-paginate, jekyll-asciidoc, jekyll-redirect-from, jekyll-feed, jekyll-sitemap, premonition]
paginate: 5
Expand Down
23 changes: 23 additions & 0 deletions _data/site_nav_pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
nav:
- title: Blogs
page: Blogs
url: /blogs/

- title: Videos
page: Videos
url: /videos/

- title: Gallery
page: Gallery
url: /gallery/

- title: Docs
url: //kubevirt.io/user-guide

- title: Labs
page: Labs
url: /labs/

- title: Community
page: Community
url: /community/
12 changes: 11 additions & 1 deletion _layouts/search.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,30 @@ <h1 class="page-title">{{ page.title }}</h1>
"url": "{{ page.url }}",
"title": "{{ page.title }}",
"author" : "{{ page.author }}",
"tags" : "{{ page.tags| join: ", " }}",
"body": "{{ page.content | markdownify | replace: '.', '. ' | replace: '</h2>', ': ' | replace: '</h3>', ': ' | replace: '</h4>', ': ' | replace: '</p>', ' ' | strip_html | strip_newlines | replace: ' ', ' ' | replace: '"', ' ' }}"{% assign counter = counter | plus: 1 %}
}, {% endif %}{% endfor %}{% for page in site.galleries %}{% if page.title == nil %}{% else %}{
"id": {{ counter }},
"url": "{{ page.url }}",
"title": "{{ page.title }}",
"author" : "{{ page.author }}",
"tags" : "{{ page.tags| join: ", " }}",
"body": "{{ page.content | markdownify | replace: '.', '. ' | replace: '</h2>', ': ' | replace: '</h3>', ': ' | replace: '</h4>', ': ' | replace: '</p>', ' ' | strip_html | strip_newlines | replace: ' ', ' ' | replace: '"', ' ' }}"{% assign counter = counter | plus: 1 %}
}, {% endif %}{% endfor %}{% for page in site.pages %}{% if page.title == nil %}{% else %}{
"id": {{ counter }},
"url": "{{ page.url }}",
"title": "{{ page.title }}",
"author" : "{{ page.author }}",
"tags" : "{{ page.tags| join: ", " }}",
"body": "{{ page.date | date: "%Y/%m/%d" }} - {{ page.content | markdownify | replace: '.', '. ' | replace: '</h2>', ': ' | replace: '</h3>', ': ' | replace: '</h4>', ': ' | replace: '</p>', ' ' | strip_html | strip_newlines | replace: ' ', ' ' | replace: '"', ' ' }}"{% assign counter = counter | plus: 1 %}
}{% endif %}{% if forloop.last %}{% else %}, {% endif %}{% endfor %}];

var idx = lunr(function () {
this.ref('id')
this.field('title')
this.field('title', { boost: 2 })
this.field('body')
this.field('author')
this.field('tags', { boost: 2 })
documents.forEach(function (doc) {
this.add(doc)
}, this)
Expand Down
44 changes: 44 additions & 0 deletions pages/gallery.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
layout: page
title: Gallery
permalink: /gallery/
navbar_active: Gallery
order: 10
---

<div class="container">
<div class="row">
<div class="col-sm-12 col-md-9 blogs">
<ul class="posts">
{% for post in site.galleries %}
{% if post.categories contains "gallery" %}
<li>
<h2 class="posts-title">
<a href="{{ post.url | prepend: site.baseurl }}">
{{ post.title }}
<div id='{{ post.url }}'></div>
</a>
</h2>
<div class="posts-date">{{ post.pub-date }}, {{ post.pub-year }}</div>
{% if post.galleria %}

<script src="//code.jquery.com/jquery.min.js"></script>
<script>
$.getJSON('/assets/galleria/{{ post.galleria }}', function(data) {
var up = document.getElementById('{{ post.url }}');
up.innerHTML = '<img src="' + data[0]['image'] + '"widht="100" height="100" align="right" />';
});
</script>
{% endif %}
{{ post.description | strip_html | truncatewords:50 }}
{% capture readmorelink %}
{{ post.url | prepend: site.baseurl }}
{% endcapture %}
{% include readmore.html href_link= readmorelink %}
</li>
{% endif %}
{% endfor %}
</ul>
</div>
</div>
</div>

0 comments on commit d9ff777

Please sign in to comment.