Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Url prettifier #2865

Open
AndreyAkinshin opened this issue Jun 8, 2018 · 12 comments
Open

Url prettifier #2865

AndreyAkinshin opened this issue Jun 8, 2018 · 12 comments
Milestone

Comments

@AndreyAkinshin
Copy link
Member

Right now, markdown files (articles) are translated to html files which are available via direct link like https://mydomain.com/articles/article-name.html. I want to "prettify" it and get an url like https://mydomain.com/articles/article-name/. Actually, I want a copy of article-name.html in https://mydomain.com/articles/article-name/index.html. Does DocFX provide any API for that?

@superyyrrzz
Copy link
Contributor

Not supported for now, but it will be supported in vNext.

@superyyrrzz superyyrrzz added the v3 label Jun 12, 2018
@AndreyAkinshin
Copy link
Member Author

@superyyrrzz great! Any ETA when it will be available?

@yufeih
Copy link
Contributor

yufeih commented Jun 13, 2018

We don't have an exact release date yet, it is a work on progress.

@yufeih
Copy link
Contributor

yufeih commented Sep 12, 2018

This is implemented in v3.

We use pretty url by default: http://a.com/article-name/. It can be into http://a.com/article-name.html by setting uglifyUrl: true

@yufeih yufeih closed this as completed Sep 12, 2018
@AndreyAkinshin
Copy link
Member Author

@yufeih, awesome, thanks!
By the way, it will be possible to automatically generate redirects from ugly urls to pretty urls? (e.g., http://a.com/article-name.html -> http://a.com/article-name/). With such redirects, all external links to old urls will be valid after prettification.

@yufeih
Copy link
Contributor

yufeih commented Sep 13, 2018

This is a static switch. docfx has no idea when you made the switch. It'll generate redirects for every new file.

Automatic redirect generation is best handled by other tools that know the exact files to be redirected during a change.

@arakis
Copy link

arakis commented May 22, 2020

Today, there's still no v3 released. So, this is a small quick and dirty workarround:

$destinationRoot = "path/to/output"

[RegEx]$Search = '(index\.html)"'
$Replace = '"'

[RegEx]$Search2 = '(\.html)"'
$Replace2 = '"'

ForEach ($File in (Get-ChildItem -Path $destinationRoot -Recurse -File)) {
    (Get-Content $File.FullName) -Replace $Search,$Replace -Replace $Search2,$Replace2 | 
        Set-Content $File.FullName
}

Live sample: https://www.aximo.games (hostet on github pages)

@AndreyAkinshin
Copy link
Member Author

@yufeih is it possible to backport this feature to v2?

@yufeih yufeih reopened this Jun 1, 2023
@yufeih
Copy link
Contributor

yufeih commented Jun 1, 2023

Reopen as the feature isn't available in v2.

@mjegob
Copy link

mjegob commented Nov 7, 2023

@yufeih any ETA when this feature will be available?
Really looking forward to it!
Thanks! 😊

@yufeih
Copy link
Contributor

yufeih commented Nov 14, 2023

@mjegob A fixed is released in v2.73.2 to allow TOC expansion work on URL rewrite. Full URL prettifier however isn't supported yet.

@yufeih yufeih removed the idea label Dec 21, 2023
@DavidMarquezF
Copy link

Any plans to add an option to build the docs with pretty urls like v3 did?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants