CMS Only

A simple way to implement a blog quickly.

Updated over a week ago

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.

4. In the Setup content structure modal, enter the name BlogContent in the group name field.

4. 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

  • url: Text

6. 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.

3. Enter the template name. We will use the name Blogs in this example.

4. Select Blog in the dropdown menu to connect to the blog content group.

5. Select a frame if desired.

6. Click ADD TEMPLATE. You will be directed to the XM.

7. Add the BlogContent section created in the previous instructions.

8. Connect the content variable from BlogContent to the Blog CMS group one.

9. Add any additional desired sections.

10. Click SAVE.

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

Creating the BlogFeed Section

πŸ“˜ Important

We need to change the Template's URL for this to work properly:

  1. Navigate to the Templates list page using the right side menu.

  2. Locate the Blog Template and click on the 3 dots next to the Template's name.

  3. Click on Edit custom URL.

  4. Change the format to: {{contentGroupName}}/{{contentItem.URL}}.

  5. Click SAVE .

For more information about custom URLs, check the Custom URL Structure docs.

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 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/${blog.url}`}>{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.

  3. Enter the page name. We will use the name Blog in this example.

  4. Enter the page path.

  5. Choose a frame if desired.
    ​

  6. Select ADD PAGE. You will be directed to the XM.

  7. Click the + and select the BlogFeed Section to add it your page.

  8. 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.
    ​

  9. Repeat the step number 7 to add any additional sections desired.
    ​

10. Click SAVE.

Updating your Blog

Adding a new blog article

  1. Navigate to the CMS

  2. Navigate to the blog content group.
    ​

  3. Click add content item to add a new entry to the blog content group.
    ​

  4. 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
    ​
    ​

5. 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.

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

Did this answer your question?