Page Templates
Access this GitHub repo to access the basic templates for adding a new React page to the site:
Steps to create a page:
-
Populate one of the templates included in this repo
1a. functional template: basic page without any state or lifecycle hooks
1b. class template if you want your page to have dynamic state or build behaviour linked to its lifecycle (e.g. fire an event when page has reloaded) -
Import your component into the page where you want it located -
import MyComponent from '/path/to/component'
- then add it into the page’s render()/return statement like any other tag<MyComponent/>
-
If you are importing into the page root app.js, it will be displayed everywhere on the site unless:
3a. you wrap it inside a Route tag:
<Route exact path="/desiredRoute" component={MyComponent} />
3b. you then add a Link tag to link to the desired path (similar to an anchor tag but compatible with React), for example in the app Navbar:
<Link to="/desiredRoute">Click Me</Link
URL in the Live Site
Your page will now appear at: https://fl-maps.publichappinessmovement.com/[the path you set]
Bringing your page into the Main Site (Docuss)
Open this Github page: fl-maps/dcs-website.json at master · focallocal/fl-maps · GitHub
To add your page at: https://fl-maps.publichappinessmovement.com/[the path you set]
Add [the path you set] only. You shouldn’t add ‘https://fl-maps.publichappinessmovement.com/’ to ‘url’ in the ‘pages’ section, then choose a name to define what url it will appear at in the main site.
Example:
-
I want to bring this page into the Main Site: fl-maps/imports/client/ui/pages/WhitePaper/Why at master · focallocal/fl-maps · GitHub
-
I can access it live here: https://fl-maps.publichappinessmovement.com/whitepaper/why
-
I add this line
{ "name": "wp_why", "url": "/whitepaper" },
to the pages section in this page: fl-maps/dcs-website.json at master · focallocal/fl-maps · GitHub -
My page is now accessible live at: Public Happiness
-
Its likely you will want to add Docuss links or balloons into it if you haven’t already so the community can engage with it. Here’s our Docuss Guide