content
content copied to clipboard
Fix the comparison between hyphens and underscores
####
Summary
Motivation
Supporting details
Related issues
Fixes #13519
Metadata
- [ ] Adds a new document
- [ ] Rewrites (or significantly expands) a document
- [x] Fixes a typo, bug, or other error
Thanks for your PR, @bshramin ! I think this needs a little more work.
The new point you've added:
The choice between using hyphens or underscores to separate words in a file name... is a matter of preference"
... is immediately contradicted by the next paragraph:
The short answer is that you should use a hyphen for your file names.
As discussed in the issue, we ought to explain a bit here about the difference between URL structure and filenames, which this part of the article does not cover. Briefly, I think, we ought to say something like:
- the question of how to name your file is as a matter of personal preference. Common choices are to use lowercase only (or at least to be aware of possible case issues with operating systems) and to use hyphens or underscores instead of spaces. What's most important here is to be consistent.
- the question of how to name files is distinct from the question of how to name URLs. The name you give a file on disk is not necessarily (or even usually) the same name as the name used in its URL. URL structure is generally determined in the configuration of your web server. There are practices you should consider when designing URL structure, in particular regarding how search engines index your pages. For example, these are Google's guidelines: https://developers.google.com/search/docs/advanced/guidelines/url-structure .
@hamishwillee , does that sound like a reasonable outline to you? It's a bit tricky because often they are the same (for instance if you are using file:// URLs or Python's http.server, and those are often going to be the first places where people encounter their own URLs. So i wonder if we ought to try to explain this a bit more...
Thank you for the review. I pushed a new commit trying to fix some of these issues.
Preview URLs
Flaws
URL: /en-US/docs/Learn/Getting_started_with_the_web/Dealing_with_files
Title: Dealing with files
on GitHub
Flaw count: 1
-
broken_links:
-
Link points to the page it's already on
-
External URLs
URL: /en-US/docs/Learn/Getting_started_with_the_web/Dealing_with_files
Title: Dealing with files
on GitHub
No new external URLs
@wbamberg Should I remove the above link? or change it to something else?
@bshramin https://github.com/mdn/content/pull/13661#pullrequestreview-961175095 notes the following:
the PR doesn't seem to incorporate the review comments at https://github.com/mdn/content/pull/13661#pullrequestreview-903288145
Do you plan on updating the PR to address those review comments?
Closing for lack of response