How to stop generating index.html for article

Hi there, I could generate my technical doc page (blogs/mytechdoc.html) with uglyURLs = true in config.toml file. However, Hugo still generates directory + index.html file (blogs/mytechdoc/index.html) in addition to uglyURL(blogs/mytechdoc.html). To me it looks awkward because the content is duplicate. Is it possible to disable the prettyURL i.e blogs/mytechdoc/index.html when uglyURL is enabled. Thanks

I am unable to reproduce the behavior as described.

With this content:

└── blogs/

And this site configuration:

baseURL = ''
languageCode = 'en-us'
title = 'My Site'
disableKinds = ['sitemap','taxonomy','term']
uglyURLs = true

Hugo produces this:

├── blogs/
│   ├── index.xml
│   └── mytechdoc.html
├── blogs.html
├── favicon.ico
├── index.html
└── index.xml

public/blogs/index.xml is the RSS feed for the blogs section. If you don’t want to generate RSS feeds, add this to your site configuration

disableKinds = ['RSS']

Hi @jmooring , Appreciate your help

You are correct. I overlooked my output files. I was getting index.xml (not index.html). Let me give the directory content.
Originally I was getting three type of files generated.

└── blogs/
    └── mytechdoc/
        └── index.html
        └── index.print.html  
        └── index.xml

Once I set the uglyURLs = true, my output stopped generating index.html, other contents were still generated

└── blogs/
    └── mytechdoc.html
    └── mytechdoc/
        └── index.print.html  
        └── index.xml

When turning on print feature, how do I generate mytechdoc.print.html instead of mytechdoc/index.print.html and similarly mytechdoc.xml. Ideally I want to avoid generating the directory mytechdoc/. Please advise.

Btw, I was using relearn theme from Hugo Relearn Theme

Without a repository to test with, the only suggestion I have is to test with a different configuration setting.

Currently you probably have:

    name= "PRINT"
    baseName = "index.print"
    isHTML = true
    mediaType = 'text/html'
    permalinkable = false
    noUgly = true

Try changing the last line to:

noUgly = false

You may not get exactly what you want, but it might be closer.

Hi @jmooring ,

I tried your step. when setting noUgly = false, printable html is not generated, but generated if it is noUgly = true. Even then this file is always generating index.print.html only under the ‘topic/’ directory. It does not generate ‘./topic.print.html’. Here is my hugo.toml copy for you. Let me know if you need to take a look at my repo or connect on a screen sharing meeting. Thank you

title = 'DDSAGAY - TechDocs Site'
baseURL = "/"
languageCode = 'en-us'
theme = 'hugo-theme-relearn'
canonifyURLs = true
relativeURLs = true
cleanDestinationDir = true
uglyURLs = true
# notBizarreAndInsaneURLs = true
# publishDir = '../wwwroot'
timeZone = 'Asia/Kolkata'

enableRobotsTXT = true

    name= "PRINT"
    baseName = ":slugorfilename.PRINT"
    #baseName = "index.print"
    isHTML = true
    mediaType = 'text/html'
    #permalinkable = false
    noUgly = true

# [permalinks]
#  '/' = '/:sections/:slugorfilename/'

#  disableXML = false

#  home = ["HTML", "RSS", "PRINT", "SEARCH"]
#  section = ["HTML", "RSS", "PRINT"]
#  page = ["HTML", "RSS", "PRINT"]
  page = ["HTML", "PRINT"]
# page = ["HTML"]

  author = "Sagayaraj"
  description = "Sagay's Learnings and Knowledge Base"
  disableBreadcrumb = false
  disableLandingPageButton = true

Well, yes, because we’re not going to try to reproduce the setup from scratch.

What time is good for you to connect? I work in IST hours

We’re going to do this asynchronously. Please share your repository, privately if you wish.

I changed my private repo to public. Here it is GitHub - sagayd/docs-ad-hugo: Documentation site development using AsciiDoctor and Hugo. During testing, I validate the output file of blogs/how-to-deploy-spinnaker.adoc. Thanks for your assistance

The theme you have chosen is heavily abstracted, with an unusual and complicated approach to producing different output formats. The theme author did not anticipate a site author’s requirement to enable uglyURLs for alternate output formats.

With this theme, in its current form, you cannot do what you want to do. If the theme were crafted differently, achieving the desired result is trivial as seen in this example:

git clone --single-branch -b hugo-forum-topic-43138 hugo-forum-topic-43138
cd hugo-forum-topic-43138
hugo server

I tested the suffix parameter per your git repo code. On your repo it works, but I could not get it working on my doc site with the theme I have used. I am reaching out to the theme owner to see how to get it done. Here is the ticket for the theme I selected: How to switch to uglyURLs=true for html files · Issue #496 · McShelby/hugo-theme-relearn · GitHub