Example blogs of actual Moogle users
- DirtyDataGirl
- Stories for kids
- NSSO Data (also, the missus)
Getting Started
Prerequisites
- Familiarity with React and SPA concepts
node
andnpm
installed locally. I use16.4.0
and7.18.1
respectively.- Familiarity with bulma (if you want to customize the blog's UI)
node-sass
should be available globally- Web hosting to serve this app
- Moogle account*
*If you don't want to use a Moogle account, read the section titled Working without a Moogle Account
.
Build and Deploy the app
- Clone this repo
cd
into the PROJECT_ROOTnpm install
npm run build
- Copy the contents of the
build
directory to your hosting - Visit your blog in the browser
Next Steps
Updating the CSS inside the PROJECT
If you want to regenerate brand-style.css
after editing PROJECT_ROOT/sass/brand-style.scss
, you need to do the following steps
cd $PROJECT_ROOT
npm run css-build
- This will replace the current
brand-style.css
css file insidesrc/
with your version with the same name - Build and deploy the app
Updating the CSS outside PROJECT_ROOT
If you want to compile brand-style.css
from PROJECT_ROOT/sass/brand-style.scss
outside the PROJECT_ROOT, follow these intructions from Bulma with one minor change
- Instead of using
mystyles.scss
from the Bulma website, start withPROJECT_ROOT/sass/brand-style.scss
Getting Oriented
The Moogle blog is a single page React blog scaffolded using create-react-app
.
You can think of Moogle as the client for a headless Moogle CMS. The Moogle CMS consists of a series of APIs to download content and manage your backend. The two primary APIs - to get the list of blogposts and the content of single blogpost are given below.
What this repo is not
This repo is the public facing portion of your blog. It presents a list of posts. Clicking on a linked post shows the full post. It does not include an Admin page for the blog. The admin page source code will be released separately.
List of Blogposts
Moogle assumes that the list of available posts of a blog can be downloaded from your-domain.com/index.json
. This setting is controlled by $POSTS_URL
in config.js
.
You can see what Moogle expects the content of index.json
to look like @ https://blog.moogle.cc/index.json
Blogpost data
For a given blogpost, Moogle pulls that blog post's data in JSON format from following URL your-domain.com/post?id=<post-id>
. id
here refers to some unique identifier which the backend uses to return your post'a content.
This setting is controlled by $POST_URL
in config.js
.
Here is an example JSON
Here's a video showing you what post data looks like - https://youtu.be/QyeTGe8eaDI
So long as your API returns the same keys as the sample post, this react app should work out of the box.
Working without a Moogle Account
The simplest way to start using this app without creating a Moogle account is to make sure that
- Your
index.json
andconstants.json
should match the structure of the output of ${POSTS_URL} and ${CONSTANTS_URL} respectively. - Your POST api, which returns the actual content of the blogpost, should match the structure of the output of ${POST_URL}
If you can ensure this, you should be able to use any backend you want.
For more advanced use cases, the source code is right here. Please fork the repo and make the changes you need to match your use case.
Conclusion
That's all for now. See you in the repo's issues list. Please keep the pull requests coming if you want to help grow this app.