yousinix / portfolYOU

A beautiful portfolio Jekyll theme that works with GitHub Pages.
https://yousinix.github.io/portfolYOU
MIT License
987 stars 594 forks source link

How to/Can I change the URL of a project #79

Closed keunes closed 3 years ago

keunes commented 3 years ago

Hello,

Exploring this theme further, I thought to change the URL of the project pages I created under _projects. Reason is that I would like to sort my projects (using the (x) indication as in the example files), while not having the number in the actual url (e.g. remove the number from www.site.com/projects/4-example-project).

I tried adding a permalink Front Matter, but that doesn't seem to work (or I'm doing something wrong). Could support for changing the URLS be added? Or if it's possible, how should I do it?

keunes commented 3 years ago

Actually, I see this code in _config.yml:

### Collections ###
collections:
  projects:
    output: true
    permalink: /projects/:name

How come name is not picked up in the URL - does it not refer to the same field in the Front Matter?

yousinix commented 3 years ago

How come name is not picked up in the URL - does it not refer to the same field in the Front Matter?

The :name placeholder refers to the file name as it's mentioned [here].(https://jekyllrb.com/docs/permalinks/#:~:text=of%20the%20document.-,%3Aname,-The%20document%27s%20base)

This leaves you with either one of these two options:

  1. Name the file as you want your project URL to look like (e.g. example-project.md).
  2. Use permalinks (I know you mentioned it doesn't work as exptected, but you might being something wrong, so please provide an example)
keunes commented 3 years ago

Many thanks! It's a bit odd (as a newcomer) that :name in the permalink definition refers to the filename, while the Front Matter variable with the same name does something completely different (setting the window title, it seems). Anyway, I digress.

I must have done something wrong indeed, the permalink I have set now does work now. But I settled for a Global permalink with :title and defining the slug: in the project's file :-)