Closed Dishant-P closed 3 years ago
There's actually a better implementation of this, one that is used by some Jekyll templates. Each category or tag could be presented as a separate menu item. So all the posts that have a tag something are shown if you open something from the menu. I'd love to see this implemented here, too.
First of all, sorry for the late response.
To add a new category like posts or projects, you need to do the following — I would assume that the new category is called articles:
Add the new category to _config.yaml
:
collections:
# ....
articles:
output: true
permalink: /articles/:name
# ....
defaults:
# ....
- scope:
path: ""
type: "articles"
values:
layout: "page"
Create a folder called _articles
and add your markdown files there. _You must follow the same front matter as posts.
Create a page called articles.html
in pages
directory and add the following content to it:
---
layout: default
title: Articles
weight: 5
permalink: /articles/
---
<div class="card-group mt-2">
{% for post in site.articles %}
<!-- Note that this must be called "post" because the post-card wasn't
made to be reused, we might improve this in the future to allow this. -->
{% include blog/post-card.html %}
{% endfor %}
</div>
Redirected here ->
So this only works for creating a new category that resembles Blog but not Projects?
I followed the steps to try to create a category that resembled projects but could not get it to work.
In particular, I called include project/project-card.html and obtained blank blobs, and if I called include project/index.html I did not get my projects in the new category... and got repeated sets of projects in the projects folder.
`
{% for project in site.team %}
<!-- Note that this must be called "post" because the post-card wasn't
made to be reused, we might improve this in the future to allow this. -->
{% include projects/index.html %}
{% endfor %}
{% for project in site.team %}
<!-- Note that this must be called "post" because the post-card wasn't
made to be reused, we might improve this in the future to allow this. -->
{% include projects/project-card.html %}
{% endfor %}
As I stated above, the project and blog cards weren't made to be reused — this was due to poor design and I am planning to change this in the future when I have time. Therefore, you have to provide the variables needed by project-card.hrml
as below, but using your new category (site.team
in your case) instead of site.projects
in the for loop:
I have little to no idea about this, so sorry if the issue is too naive. But I wanted to know how can I add same page like Blog, and rename it and add other content there. So same theme like the blogs page but different content. Thanks.