I am unable to find a solution, in Hugo I need to create a .md page to add content but the directory I want to add the content is /properties however to make the content easily filterable I am using category which also name /properties
how can I use the content directory /properties and use categories /properties and make Hugo aware to generate only category pages and do not generate any /directory urls?
# URL created
#categories pages auto generated by Hugo
# URL created
I need to have the content directory as I need to add those pages somewhere. so how can I solve this issue can I tell Hugo the
content/properties/ is actually a category?
Generate categories with different url through your config file
categories = "/category/:slug/"
I do not want to generate a different url I am happy with the url
# URL created by category
I just want to avoid duplicate pages also created by the directory
I cannot just not add /properties in the directory folder as Hugo needs this pages to generate content
So I am unable to find a solution or tell Hugo that the content in the directory
/properties is actually the category
If you don’t want duplicate pages, you perhaps should not use a category with the same name as a section. Or not use categories at all.
You’ll probably not get different answers by asking the same question in different posts, btw.
Please do not jump into a post if you cannot provide some value to it.
If I was able to use a category with different name that would have been easier of course.
As a beginner I am wondering and exploring how Hugo works and how to make different things work here.
So please let me share my issue as I hope to get some tips or tricks on how to solve this.
Please do not ask the same question in different threads.
You are completely free to chose the name of your category. What you’re saying (if I understand you correctly) is this:
- I want categories
- I want a category to be “properties”
- I want a section that’s named “properties”
- I don’t want the section and the category to be duplicates
I don’t understand
- Why you think that would be a problem (given that you could rename the section or the category or both to anything you fancy)?
- Why you think that you need categories as well as sections?
- If you’ve played around with some sample documents to see what happens you can do and how the website generated by Hugo will be organized
The categories of
properties > sale/rent > residential/commerical is what I want and I am glad Hugo generates these for me and it is really easy to create navigations for this.
However I need to create page for these listings in the content directory and I name the directory
/properties now the issue is if I change the content directory to for example
/listings this is going to create a duplication issue for me as I am going to have same page generate twice
# The category page
# And the page url which Hugo generates
changing the category or content directory name does not solve my issue. I want Hugo to generate only 1 page and I prefer the way categories work however I need to also add content in the content directory which also creates the same page twice.
Since listings grow quickly duplication is going to create mess both for SEO and for the site size.
I have searched a lot Hugo but did not find how to solve the duplication issue
Hm. I have a very small travelling blog, using two taxonomies:
The possible terms for these taxonomies should be obvious.
Suppose I have a blog text in
with the obvious front matter values
When I generate my site with Hugo, I get three directories under
blog/my-trip-to-france contains the blog text itself. The other two directories contain only
index.html files that list the relevant content (in the way that I want it to be listed). I do not see any duplication there.
It would help if you posted a link to your GitHub repository here so that someone could see what you’re actually doing and perhaps fix whatever needs fixing.
category /listings & content directory /properties will produce
# directory /properties/ property-1
# category listing
# which show all listings under that category will show single page as
# instead of
# it will not create duplicate urls
using the directory path for me is impossible since I have for example
So this make it a very long sub directory paths
Post a link to your repo. There’s no point in discussing that further without seeing your code.
I do not have any repo I am using the giraffe academy Hugo theme and just trying to organise content to see how categories and directories can work together but from what I understand it doesn’t.
Maybe I leave the property directory as it is and use categories from one step down instead of properties I start categorising from
Thanks it does help even if we communicate without understanding what the issue and solution is.
Actually issue remains which is the directory and category conflict
if I have a category called properties and then sub categories such as sale/rent I can easily navigate and end to the property page with all the properties.
But if I have the category listings or if I do not use the main category I cannot end up to the properties page
my desired path is
example.com/properties/ which is generated from the Hugo content directory
and then start using subcategories such as sale or rent, residential or commercial etc.
and when I am at sale for example I can go back to properties
should I use
categories = "/properties/:slug/"
so the subcategories can lead back to the main properties page or my brain have given up in understanding Hugo?
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.