Set page URL in YAML?

I’m new to Kirby, working on setting up a personal website to share some writing and a work portfolio. I’ve worked with other static site generators in the past–Pelican and Jekyll–which have their own learning challenges.

With minimal programming knowledge and a love of Markdown, I would rather create and edit pages as text files than by customizing and using the panel. In the panel, changing the URL of a page is simple. Is there a way to set the URL with a field in the YAML of a project.txt (or other page) file?

You could achieve that, but this would only work and make sense if you use a custom URL method in combination with routes.

So instead of using the standard url() method to create your links within the page, you would use a custom page method that generates the URL from that field. And then in your router, you would find the page by that field as well.

Why not rename the page folder instead?

Thanks. It looks like I should name folders instead, though I’m still trying to understand the folder structure for Kirby. One of the projects in my portfolio is “Classes and Talks.” I’m sharing a brief description and some slides as examples, and I’d like to have a separate page for each example.

If I create a folder inside the “1-classes-talks” folder, the subfolder doesn’t seem to generate a page in that directory (or at all?). In the panel, I think I created a page inside the projects folder, which allows me to create subpages. Here’s the folder structure I now have for a talk on e-readers:

1-projects
    1-classes-talks
    classes-talks
        1-e-readers

The resulting URL is “/projects/classes-talks/e-readers” which is what I’d like to have. It’s not how I thought folders would be nested.

it’s either this

1-projects
    1-classes-talks
        1-e-readers

or this

1-projects
    classes-talks
        1-e-readers

In both cases you’ll have a url that looks like this projects/classes-talks/e-readers

I could be wrong, but if I remember correctly, the sorting number doesn’t really have anything to do with the visibility of a page which is why you can’t have two folders with the same name inside the same parent folder

Prepended numbers are only a visibility flag you can use for several use cases, they don’t really mean anything regarding the accessibility of a page in the browser. The number is ignored in page urls (but used in links to files).

What @manuelmoreale said above is correct. From a Kirby perspective, you can’t have 1-projects and projects, both pages would have the same URL.

Apart from that, each folder name is a separate URL, so the folder /content/projects would result in https://domain.com/projects etc.

Thanks to you both. I’m so new to Kirby, I probably missed something basic in what I was doing.

No problem, we are here to help. I think the Starterkit is a good starting point to get an idea how it works. Also the Getting Started guide.

Yes, I’m editing files in the Starterkit to do my first tests. That’s why I’m renaming some pages and sorting out what information to put in the txt files. I can see I’m going to have a lot of files named article.txt, project.txt, etc.