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

fix: modify third nav title when renaming subfolder #200

Merged

Conversation

prestonlimlianjie
Copy link
Contributor

@prestonlimlianjie prestonlimlianjie commented Jun 15, 2021

This PR fixes #185.

Problem

The current renameSubfolder route method does the following:

  • Rename all files from ${folder}/${previousSubfolder}/${fileName} to ${folder}/${newSubfolder}/${fileName} using git trees
  • Modify the collection.yml file within the collection folder

However, this neglects to modify the third_nav_title fields within the collection subfolder files.

Fix

This PR fixes the abovementioned problem by taking the following approach:

  • For each file in the ${folder}/${previousSubfolder} folder
    • Create the new content for each file by modifying the third_nav_title field in each retrieved file
    • Save the new content in the new ${folder}/${newSubfolder} folder
  • Modify the collection.yml file within the collection folder

Note

This fix - while functional - is not ideal because it just adds more business logic to the routes layer. We will clean this up in the upcoming backend refactor.

Copy link
Contributor

@kwajiehao kwajiehao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm

As discussed offline, we will need to revert the effects of this change when we eventually modify our templates to use collections.yml instead of each individual page's third_nav_title front matter attributed. Issue #202 was created to track this

@prestonlimlianjie prestonlimlianjie merged commit 3b7340e into develop Jun 16, 2021
@prestonlimlianjie prestonlimlianjie deleted the fix/modify-third-nav-title-when-renaming-subfolder branch June 16, 2021 06:50
harishv7 pushed a commit that referenced this pull request Feb 17, 2023
* fix: rename third_nav_title when renaming collection

* fix: deslugify third_nav_title name
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

Successfully merging this pull request may close these issues.

updating third nav folder name does not update third nav title name
2 participants