sadmansh
sadmansh

Reputation: 927

Can I have separate category slug and title for a Jekyll blog?

I am building a Jekyll website where I will have categorized pages. A page might have a category called "Introduction to programming" but I want the category slug to be "cse110" so as to keep my URLs short.

Is there any way I can achieve this? Thanks in advance.

Upvotes: 1

Views: 245

Answers (2)

Mr. Hugo
Mr. Hugo

Reputation: 12592

You can use the permlink in the frontmatter to manipulate the output directory. Your category page will look something like this:

---
title: Introduction to programming
permalink: /cse110/
---

Upvotes: 0

Sharath kumar
Sharath kumar

Reputation: 1156

Use cse110 as category. That should take care of the URL part. Now for the title, write a condition that whenever the category is cse110, it should show "Introduction to Programming"

{% if page.categories == 'cse110' %}
<span>Introsuction to Programming</span>
{% endif %}

Something like that should work.

Upvotes: 2

Related Questions