Skip to content

Commit

Permalink
feat: use more appropriate page titles for info subpages
Browse files Browse the repository at this point in the history
fix #134
  • Loading branch information
erichartline committed May 31, 2019
1 parent 19dcf75 commit 142e7de
Show file tree
Hide file tree
Showing 2 changed files with 97 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/components/pages/EditablePages/InfoPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import InfoPageView from "components/pages/EditablePages/InfoPageView"
import ErrorPage from "components/pages/ErrorPage"
import { fetchPage } from "actions/editablePages"
import { NAMESPACE } from "constants/namespace"
import { pageTitleLookup } from "utils/pageTitleConversions"

type Props = {
/** Checks if data is currently being fetched */
Expand Down Expand Up @@ -52,15 +53,13 @@ class InfoPage extends Component<Props> {

render() {
const { isFetching, page, match, error } = this.props
const name = page.data.attributes.name
const name = pageTitleLookup(page.data.attributes.name)

if (!isFetching && page.data.attributes.content) {
return (
<Grid container justify="center">
<Helmet>
<title>
{name.charAt(0).toUpperCase() + name.slice(1)} Page - dictyBase
</title>
<title>{name} - dictyBase</title>
</Helmet>
<Grid item xs={8}>
<InfoPageView page={page} match={match} />
Expand Down
94 changes: 94 additions & 0 deletions src/utils/pageTitleConversions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
const pageTitles = {
// pages from navbar
art: "dictyArt",
citation: "Citing dictyBase and the Dictyostelium Genome Project",
codon: "Codon Bias Table",
conference: "Annual International Dictyostelium Conference",
gallery: "Dictyostelium Multimedia",
history: "History",
jobs: "Job Opportunities",
labs: "Dicty Labs on the Web",
learn: "Learn About Dictyostelium",
links: "Useful Links",
listserv: "dicty ListServ",
nomenclature: "Nomenclature Guidelines",
ontology: "Dictyostelium Anatomy Ontology",
phenotype: "Phenotypes for Dictyostelium mutants",
teach: "Teaching Tools Using Dictyostelium discoideum",
techniques: "Dictyostelium Techniques",
// techniques subpages
media: "dictyBase Media and Buffers",
"fm-medium": "Recipe for FM Defined Medium",
"low-flo-medium": "Low Fluorescence Axenic Medium",
growth: "Protocols for growing Dictyostelium discoideum",
development: "Protocols for Dictyostelium discoideum development",
"dicty-storage":
"Protocols for long-term storage of Dictyostelium discoideum",
"soft-agar": "Plating Dictyostelium in soft agar",
"parasexual-genetics": "Parasexual Genetics in Dictyostelium",
"mating-types":
"Method for determining mating types of Dictyostelium discoideum",
"quick-genomic-dna-extraction":
"Quick preparation of genomic DNA for PCR analysis",
"genomic-dna-extraction": "Extraction of genomic DNA",
"genomic-dna-extraction-csci": "Extraction of genomic DNA (CsCI)",
"rt-pcr": "DRT-PCR for Knockout Screening and Expression Analysis",
"transformation-protocols":
"Transformation of Dictyostelium discoideum with plasmid DNA",
"calcium-phosphate-precipitation":
"Transformation of Dictyostelium by calcium phosphate precipitation",
electroporation: "Transformation of Dicty by electroporation",
"transformation-nc4":
"Transformation of NC4 or D. mucoroides with vectors containing the V18-Tn5 cassette",
"microinjection:": "",
"transformation-by-particle-gun": "",
"addition-of-heat-killed-bacteria": "",
"transformant-selection-bacterial-lawns": "",
"dapi-electroporation": "Electroporation of DAPI into Dictyostelium",
"remi-mutagenesis":
"REMI- Restriction-enzyme-mediated insertional mutagenesis",
"rnai-procedure": "",
"double-mutants": "",
"chromatin-immuno-precipitation": "",
"whole-mount-in-situ-hybridization": "",
"agar-overlay": "",
"indirect-immunofluoresence": "",
"fixation-techniques": "",
"visualizing-weak-fluoresence": "",
"s-methionine-labelling": "",
"phosphate-labelling": "",
"cytoskeleton-isolation": "Cytoskeleton isolation",
"centrosomes-isolation": "Isolation of Dictyostelium centrosomes",
"preparation-of-microtubule-associated-motor-proteins": "",
"purification-of-muscle-action": "",
"one-day-myosin-prep": "",
"three-day-myosin-prep": "",
"cell-staining": "",
"microtubule-gliding-assay": "",
"atpase-assay-dynein": "",
"ctpase-assay-dynein": "",
"in-vitro-motility-assay": "",
"atpase-assay-myosin": "",
"estimation-active-myosin-heads": "",
"myosin-f-actin-binding": "",
"anti-y-tubulin-westerns": "",
}

/**
* pageTitleLookup gets a page name from the content API
* and attempts to convert it to a more useful page title.
* This is helpful for SEO purposes.
*/

const pageTitleLookup = title => {
let name

if (title in pageTitles) {
name = pageTitles[title]
} else {
name = "Information Page"
}
return name
}

export { pageTitles, pageTitleLookup }

0 comments on commit 142e7de

Please sign in to comment.