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

Review lib/index.js for any remaining hard-coded strings #242

Closed
kilemensi opened this issue Sep 1, 2022 · 13 comments · Fixed by #246
Closed

Review lib/index.js for any remaining hard-coded strings #242

kilemensi opened this issue Sep 1, 2022 · 13 comments · Fixed by #246
Assignees
Labels
chore A task that needs to be done (neither enhancement or bug) enhancement New feature or request

Comments

@kilemensi
Copy link
Member

kilemensi commented Sep 1, 2022

Now we have full integration with CMSes, it's time to review and remove all remaining hard-coded strings in code. Specifically, we should comb through lib/index.js.

@kilemensi kilemensi added chore A task that needs to be done (neither enhancement or bug) enhancement New feature or request labels Sep 1, 2022
@kilemensi kilemensi moved this to Todo in COMMONS Sep 1, 2022
@kelvinkipruto kelvinkipruto self-assigned this Sep 2, 2022
@kelvinkipruto
Copy link
Contributor

@kilemensi Going through this, and it most of the hard-coded titles are section titles and slugs.

@kilemensi
Copy link
Member Author

@kilemensi Going through this, ...

Correct @kelvinkipruto. Can we move them to their respective sections in the NetlifyCMS?

@kelvinkipruto
Copy link
Contributor

@kilemensi how do you propose we do this? I was thinking of a different collection say Sections then add the title and slug, for each possible section, but then I realised most of them are repeated irregardless of the section they are in, example hero , related-stories, and news-stories,

@kilemensi
Copy link
Member Author

Give me a real example of what you've found @kelvinkipruto and lets discuss it.

@kilemensi
Copy link
Member Author

Making any headway on this @kelvinkipruto ?

@kelvinkipruto
Copy link
Contributor

kelvinkipruto commented Sep 8, 2022

@kilemensi, I have run into a few issues here. The major one of them is related to hidden fields in Netlify CMS. It looks like they don't appear in the .md file as described here and also some open issues regarding it like this. An example in our case would be here where the hidden fields are not added to the .md file.

@kilemensi
Copy link
Member Author

@kilemensi, I have run into a few issues here. The

Hey @kelvinkipruto.

Before I spend some time looking into that, how're hidden fields related to this current issue?

@kelvinkipruto
Copy link
Contributor

@kilemensi We need to move the hard-coded slugs and titles to the cms as hidden fields.

@kilemensi
Copy link
Member Author

kilemensi commented Sep 8, 2022

@kilemensi We need to move the hard-coded slugs and titles to the cms as hidden fields.

Do we? Did you try #246 (comment)?

i.e. as long as you include slug in fields array, the getCollectionBySlug method will return the slug as part of the result.

Can you share an example where that doesn't work @kelvinkipruto ?

@kelvinkipruto
Copy link
Contributor

@kilemensi Yes I have tried it. In this case the slug returned will be about since the slug in getCollectionBySlug is derived from the filename. The correct slug should be get-in-touch

@kilemensi
Copy link
Member Author

@kilemensi Yes I have tried it. In ...

I've update #246 to handle this case using get-in-touch as an example @kelvinkipruto

@kelvinkipruto
Copy link
Contributor

@kilemensi Let me have a look

@kilemensi
Copy link
Member Author

@kilemensi Let me have a look

And @kelvinkipruto ?

Repository owner moved this from Todo to Done in COMMONS Sep 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore A task that needs to be done (neither enhancement or bug) enhancement New feature or request
Projects
Status: ✅ Done
Development

Successfully merging a pull request may close this issue.

2 participants