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

Should we let .html be used? #102

Closed
edwardhorsford opened this issue Dec 7, 2015 · 13 comments
Closed

Should we let .html be used? #102

edwardhorsford opened this issue Dec 7, 2015 · 13 comments

Comments

@edwardhorsford
Copy link
Contributor

Should be let users have .html on the end of their route?

I recently tried to access a page, and mistakenly included .html on the end, as I copied the file name in to the browser. This feels like it could be a mistake other makes, and something we could take care of in our routing.

@joelanman
Copy link
Contributor

I've not had this issue personally - anyone else?

@timpaul
Copy link
Contributor

timpaul commented Dec 16, 2015

No, but I watched Ed do it ;-)

Are there any problems doing this could cause?

@joelanman
Copy link
Contributor

well, any new code adds maintenance work - we need to know there's real need. hmm, we'd need to be careful that it still worked when people wrote their own routes or you could get weird behaviour.

@edwardhorsford
Copy link
Contributor Author

I just watched @aduggin make this same mistake.

I reckon if .html is applied, we should redirect to the same url without .html. If that route exists, it will work, else it will 404 as it should.

@joelanman
Copy link
Contributor

that sounds reasonable to me

@timpaul
Copy link
Contributor

timpaul commented Feb 8, 2016

What happens if you have a directory called 'foo' at the same level as 'foo.html'? Or is that basically something you should NEVER DO?

@edwardhorsford
Copy link
Contributor Author

@timpaul I'm not sure that's relevant? Right now if you go to localhost:3000/foo.html you won't get foo.html - it will error instead. This suggests removing the .html bit and searching that instead. Which will then fall back to whatever behavior we currently have.

@tsmorgan
Copy link
Contributor

tsmorgan commented Feb 8, 2016

@edwardhorsford I'm with @timpaul. If you redirect localhost:3000/foo.html to localhost:3000/foo and leave the prototype with the behaviour we currently have, then you could have a situation where what you end up displaying is the template at /app/views/foo/index.html.

To really make this work you'd want to detect .html on the URL, remove it, but in those circumstances prevent the kit looking for /app/views/foo/index.htmlas a backup.

@joelanman
Copy link
Contributor

That behaviour seems OK to me? The redirect will drop .html, so I don't think it'd be too hard to figure out what was happening?

@timpaul
Copy link
Contributor

timpaul commented Feb 9, 2016

Yeah, I'm guessing you really should avoid having folders and files with
the same name at the same level anyway right?

On 8 February 2016 at 21:02, Joe Lanman [email protected] wrote:

That behaviour seems OK to me? The redirect will drop .html, so I don't
think it'd be too hard to figure out what was happening?


Reply to this email directly or view it on GitHub
#102 (comment)
.

@joelanman
Copy link
Contributor

currently the file wins out - it gets checked first

@tsmorgan
Copy link
Contributor

tsmorgan commented Feb 9, 2016

Yeah I see what you mean. You're not going to be left looking at localhost:3000/foo.html in the address bar and actually seeing the /app/views/foo/index.html template. I'm sure you're right it's unlikely to confused people in that respect.

@edwardhorsford
Copy link
Contributor Author

I just saw @finiteattention make this same mistake, adding .htm and then .html to the end of her page.

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

4 participants