feat(home): add latest projects and posts section
This commit is contained in:
		@@ -22,5 +22,38 @@
 | 
			
		||||
	</script>
 | 
			
		||||
</section>
 | 
			
		||||
 | 
			
		||||
{# how many items to show #}
 | 
			
		||||
{% set n = 6 %}
 | 
			
		||||
 | 
			
		||||
{# fetch sections #}
 | 
			
		||||
{% set posts = get_section(path="posts/_index.md") %}
 | 
			
		||||
{% set projects = get_section(path="projects/_index.md") %}
 | 
			
		||||
 | 
			
		||||
{# merge, sort by date (desc), take first n #}
 | 
			
		||||
{% set latest = posts.pages
 | 
			
		||||
	| concat(with=projects.pages)
 | 
			
		||||
	| sort(attribute="date")
 | 
			
		||||
	| reverse
 | 
			
		||||
	| slice(end=n)
 | 
			
		||||
%}
 | 
			
		||||
 | 
			
		||||
<section class="latest-projects-posts">
 | 
			
		||||
	<h2>Latest projects & posts</h2>
 | 
			
		||||
	{% for page in latest %}
 | 
			
		||||
		<div class="project">
 | 
			
		||||
			<a class="title" href="{{ page.permalink }}">{{ page.title }}</a>
 | 
			
		||||
			<p class="description">
 | 
			
		||||
				{% if page.description %}{{ page.description }}{% else %}…{% endif %}
 | 
			
		||||
			</p>
 | 
			
		||||
			<hr>
 | 
			
		||||
			<p>
 | 
			
		||||
				{{ page.date }}
 | 
			
		||||
				{% if page.path is starting_with("posts/") %} · Post
 | 
			
		||||
				{% elif page.path is starting_with("projects/") %} · Project
 | 
			
		||||
				{% endif %}
 | 
			
		||||
			</p>
 | 
			
		||||
		</div>
 | 
			
		||||
	{% endfor %}
 | 
			
		||||
</section>
 | 
			
		||||
{% endblock content %}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user