AlexsLemonade / AlexsLemonade/refinebio-web
Add getPageTitle helper to the PageTitle component
Open
@nozomione is already working on this.
Since Oct 15, 2024.
Post QA
- Dominant language
- JavaScript
- Stars
- 1
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
Context
Currently, we use a switch statement and regex patterns to determine the prefix for each page's <title /> HTML tag
for SEO in the PageTitle component.
switch (true) {
case title.length > 0:
pageTitle = `${title}`
break
case home:
pageTitle = `${appName} - Search for harmonized transcriptome data`
break
case /\/about$/.test(path):
pageTitle = `About`
break
case /\/dataset/.test(path):
pageTitle = `Dataset -`
break
case /\/download/.test(path):
pageTitle = `Download Dataset -`
break
case /\/license$/.test(path):
pageTitle = `License -`
break
case /\/privvacy$/.test(path):
pageTitle = `Privacy -`
break
case /\/terms$/.test(path):
pageTitle = `Terms of Use -`
break
default:
break
}
In this issue, we want to replace the switch with an if statement, and instead of using regex, we'll define all prefix values for the pages using an object.
Problem or idea
To achieve this, we should make the following changes to PageTitle:
- Add a new object containing all possible prefixes for the pages
- Add a new helper method that returns the appropriate prefix based on the route values
Solution or next step
In PageTitle:
- Add a new constant object,
titlePrefixes, to store prefix values for pages - Add a new helper
getPageTitlethat does the following:- Takes a route path as its argument
- Returns the corresponding prefix value using
ifandtitlePrefixes
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.