CMS Only

A simple way to implement a blog quickly.

Getting Started

Creating the Blog content group

  1. Navigate to your Shogun Frontend store.
  2. In the sidebar, select Content.
  3. Click the Add content group button.
  1. In the Setup content structure modal, enter the name BlogContent in the group name field.
  1. Select the + Add field button, enter the name, select the type, and click Add field.

Repeat to add the following fields with the labels and types below:

  • Name: Text (this field is created by default)
  • Date: Text
  • Author: Text
  • Hero: Media
  • Content: Richtext
  1. Click SAVE.

Creating the BlogContent Section

The BlogContent Section accepts a prop called content that will receive the data from the content Blog CMS group variable.

import React from 'react'
import { RichText } from 'frontend-ui'

import './styles.css'

const BlogContent = ({ content }) => {
  return (
    <article className="BlogContent">
      <RichText source={content} />
    </article>
  )
}

export default BlogContent

To customize the styles from the RichText content, do something as the example below:

.BlogContent {
  width: 80em;
  margin: auto;
  padding: 2em 1em;
}

.BlogContent p {
  margin: 10px 0;
}

.BlogContent img {
  width: 100%;
  height: auto;
}

Creating the Blog Template

  1. Navigate to templates.
  2. Select Add Template.
  1. Enter the template name. We will use the name Blogs in this example.
  2. Select Blog in the dropdown menu to connect to the blog content group.
  3. Select a frame if desired.
  4. Click ADD TEMPLATE. You will be directed to the XM.
  1. Add the BlogContent section created in the previous instructions.
  2. Connect the content variable from BlogContent to the Blog CMS group one.
  3. Add any additional desired sections.
  1. Click SAVE.

Pages will now automatically be created for all items in the Blog content group.

Creating the BlogFeed Section

The BlogFeed Section will take an array of blog posts and map them as result.

import React from 'react'
import ResponsiveImage from 'frontend-ui/ResponsiveImage'
import Link from 'frontend-link'
import { useRouter } from 'frontend-router'

const slugify = string =>
  string.toLowerCase()
    .replace(/[^\w\s-]/g, '') // remove non-word [a-z0-9_], non-whitespace, non-hyphen characters
    .replace(/[\s_-]+/g, '-') // swap any length of whitespace, underscore, hyphen characters with a single -
    .replace(/^-+|-+$/g, '') // remove leading, trailing

const BlogFeed = ({ blogs = [], title }) => {
  const router = useRouter()

  return (
    <section>
      <h1>{title || 'Blog'}</h1>
      <div>
        {blogs.map((blog, index) => (
          <article key={`blog-item-${index}`}>
            <p><time>{blog.date}</time> - by {blog.author}</p>
            <h2><Link href={`/blog/${slugify(blog.name)}`}>{blog.name}</Link></h2>
            <ResponsiveImage src={blog.hero.src} alt="" />
          </article>
        ))}
      </div>
    </section>
  )
}

export default BlogFeed

Creating a Blog feed page

  1. Navigate to Pages.
  2. Select ADD PAGE.
  1. Enter the page name. We will use the name Blog in this example.
  2. Enter the page path.
  3. Choose a frame if desired.
  1. Select ADD PAGE. You will be directed to the XM.
  2. Click the + and select the BlogFeed Section to add it your page.
  3. Click on the BlogFeed Section to open it, and click on SELECT ALL under Blogs prop to automatically receive all the entries from the Blog CMS Group.
  1. Repeat the step number 7 to add any additional sections desired.
  1. Click SAVE.

Updating your Blog

Adding a new blog article

  1. Navigate to the CMS
  2. Navigate to the blog content group.
  1. Click add content item to add a new entry to the blog content group.
  1. Enter content for the following fields:

NAME: This field is the throughput to the app and used to generate the page path/URL.

Sentence or title case can be used and the app will format it to be URL friendly for the page path/URL.

CONTENT: This is the content used on the blog entry

FEATUREIMAGE: This image is used as the header of the blog article and used for the link on the /blog page

AUTHOR: The name of the author displayed at the start of the blog entry

DATE The article date displayed at the start of the blog entry

  1. Click SAVE.

Editing blog content

  1. Navigate to Content.
  2. Search for the blog entry you wish to edit.
  3. Select the entry containing content you wish to edit.
  4. Make changes.
  5. Click SAVE.

Wrapping up

Adding a blog article to the blog feed page

This step is only necessary if you chose to add content manually when creating your blogfeed section. The blog feed will be automatically updated with new articles otherwise.

  1. Navigate to pages.
  2. Find the blog feed page.
  3. Click on the page row or click the edit icon.
  4. Click on the BlogFeed section.
  5. In the Blogs field click Add Value...
  6. Select the new blog article you created
  7. Click SAVE.

Publishing

  1. If you are happy with the blog article and feed pages in the preview, change the blog article page status to Draft to Ready to Publish
  2. Select View and Publish. You will be directed to a list of pages that will be updated upon publishing.

📘

Only page updates appear here. Updates to content or section code will not list affected pages, but these changes will be included.

  1. When publishing is complete, you will see a notification.

Did this page help you?