Skip to content

Commit

Permalink
Lowercase filenames to match default slugs (#312)
Browse files Browse the repository at this point in the history
* Lowercase filenames to match default slugs

Currently, all slugs are forced to lowercase on Readme.com.
However when syncing, it left the name as uppercase, which **always**
resulted in a 404, and thus a new page being created.

* Lowercase filenames to match default slugs

Currently, all slugs are forced to lowercase on Readme.com.
However when syncing, it left the name as uppercase, which **always**
resulted in a 404, and thus a new page being created.
  • Loading branch information
ollyfg authored Jul 9, 2021
1 parent 04e7f93 commit 5503c04
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/cmds/docs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ exports.run = function (opts) {
files.map(async filename => {
const file = await readFile(path.join(folder, filename), 'utf8');
const matter = frontMatter(file);
// Stripping the markdown extension from the filename
const slug = filename.replace(path.extname(filename), '');
// Stripping the markdown extension from the filename and lowecasing to get the default slug
const slug = filename.replace(path.extname(filename), '').toLowerCase();
const hash = crypto.createHash('sha1').update(file).digest('hex');

return request
Expand Down

0 comments on commit 5503c04

Please sign in to comment.