From 142e7de6a7b3c48dcb42932ceaf514828afa3729 Mon Sep 17 00:00:00 2001 From: wildlifehexagon Date: Fri, 31 May 2019 17:07:22 -0500 Subject: [PATCH] feat: use more appropriate page titles for info subpages fix #134 --- .../pages/EditablePages/InfoPage.js | 7 +- src/utils/pageTitleConversions.js | 94 +++++++++++++++++++ 2 files changed, 97 insertions(+), 4 deletions(-) create mode 100644 src/utils/pageTitleConversions.js diff --git a/src/components/pages/EditablePages/InfoPage.js b/src/components/pages/EditablePages/InfoPage.js index 9464025bd..36f057e94 100644 --- a/src/components/pages/EditablePages/InfoPage.js +++ b/src/components/pages/EditablePages/InfoPage.js @@ -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 */ @@ -52,15 +53,13 @@ class InfoPage extends Component { 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 ( - - {name.charAt(0).toUpperCase() + name.slice(1)} Page - dictyBase - + {name} - dictyBase diff --git a/src/utils/pageTitleConversions.js b/src/utils/pageTitleConversions.js new file mode 100644 index 000000000..cd5351f3c --- /dev/null +++ b/src/utils/pageTitleConversions.js @@ -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 }