Skip to content
This repository was archived by the owner on Dec 14, 2018. It is now read-only.

Support Razor Pages with Dash/Hyphon in the name for nice URLs #6316

Closed
schotime opened this issue May 24, 2017 · 4 comments
Closed

Support Razor Pages with Dash/Hyphon in the name for nice URLs #6316

schotime opened this issue May 24, 2017 · 4 comments

Comments

@schotime
Copy link

It seems like Razor Pages doesn't support pages with hyphons/dashes in them.

With no way to change the current URL and only append, this doesn't allow you to have hyphon/dash separated URLs. eg. Blog/this-awesome-blog-post

@rynowak
Copy link
Member

rynowak commented May 24, 2017

A few thoughts...

Typically in a scheme like Blog/this-awesome-blog-post the Blog part is fixed and the this-awesome-post slug comes from a database/parameter so it's not part of the page name.

We recently fixed a bug that was blocking the use of characters that were invalid in class names but valid in filenames, #6296 . This fix will be included in 2.0.0-preview2.

We also have a way to completely customize the route used by the page through application model, we just haven't done much to make it friendly to use: https://github.com/aspnet/Mvc/blob/dev/src/Microsoft.AspNetCore.Mvc.RazorPages/ApplicationModels/PageApplicationModel.cs#L84

This has the same set of knobs we use to configure routing for controller-based actions. We haven't said much about this external to the team because it's not very polished yet.


Does this address your needs?

@schotime
Copy link
Author

Thanks for that.
Yeh....blog was a bad example but its definitely something that would be great. We're using underscores at the moment.
Where/When do I get access to this change this model?

@rynowak
Copy link
Member

rynowak commented May 25, 2017

You can access this today by creating an IPageApplicationModelProvider and registering as a service. It's a big hammer.

We'll be providing a nice experience for this after preview 2 #6325

@rynowak
Copy link
Member

rynowak commented May 25, 2017

I'll take that back, it looks like we're doing something about this for 2.0.0-preview2, but it won't be complete.

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

No branches or pull requests

3 participants