How do I know which folder the Markdown file is in?

Under the content folder there are folders where I grouped my articles and inside each folder there are and markdown files with my articles.


The contents of these files are as follows (there are many folders, I only gave one example)

title: Webmaster Page
url: webmaster

What I want to do is to get the url: variable in the file in the folder where the markdown file is in single.html.

So for example I have an article under the content/webmaster folder. To show that this article is in the webmaster category, I take the url: parameter in the file under the webmaster folder and link to it. (I also need to get single.html)

Note: I disable Tags and Categories, I don’t use them.

If such a thing is possible, I would be very grateful if you could help me. If not, let me know in a reply and I will try to find other solutions myself.

1 Like

First, why are you setting url to webmaster? That is already determined by the directory name.

Second, if you are rendering webmaster/ and want to get to the section page, use the .CurrentSection method.


I use a multilingual configuration, so sometimes I change the url of the folders according to the language.

.CurrentSection thank you very much for your answer. It gives me the path

Is there any chance to get the url: variable in this

1 Like

.CurrentSection is a page. So, .CurrentSection.RelPermalink.


Thank you for your answer, it works.

I also discovered that I can get it like this while trying it now.


1 Like

That will give you the value of url in front matter, but not necessarily the URL of the section.


Yes, I noticed, thank you again for the information. I wanted to write in case users need another parameter and see the topic.

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.