You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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){casetitle.length>0:
pageTitle=`${title}`breakcasehome:
pageTitle=`${appName} - Search for harmonized transcriptome data`breakcase/\/about$/.test(path):
pageTitle=`About`breakcase/\/dataset/.test(path):
pageTitle=`Dataset -`breakcase/\/download/.test(path):
pageTitle=`Download Dataset -`breakcase/\/license$/.test(path):
pageTitle=`License -`breakcase/\/privvacy$/.test(path):
pageTitle=`Privacy -`breakcase/\/terms$/.test(path):
pageTitle=`Terms of Use -`breakdefault:
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 getPageTitle that does the following:
Takes a route path as its argument
Returns the corresponding prefix value using if and titlePrefixes
The text was updated successfully, but these errors were encountered:
Context
Currently, we use a
switch
statement and regex patterns to determine the prefix for each page's<title />
HTML tagfor SEO in the
PageTitle
component.In this issue, we want to replace the
switch
with anif
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
:Solution or next step
In
PageTitle
:titlePrefixes
, to store prefix values for pagesgetPageTitle
that does the following:if
andtitlePrefixes
The text was updated successfully, but these errors were encountered: