How To: Add Author To Articles

  • In this tutorial we are going to add an "Author" Custom Object to a particular article. The "Author" object will contain the following fields.

    • Name : String
    • Biography : HTML
    • Image : Image

    Once we create the "Author" Object type and we will associate an instance of the Author object type with a particular article. For this example we will be using the "First Post" article.

    To start, we need to set up our configuration. Go to Metafield Configuration and click "Add Metafield" under article. Add the metafield listed below.

    • author : Custom-object

    When finished, your configuration should look like the image below.

  • Now we need to create the "Author" custom object. Do this by returning to the homepage and clicking on Edit your Custom Object Configurations then clicking on Create a new Object Type.

    Now its time to add the metafields for each "Author" Custom Object. Enter "author" for the custom object handle and then add the following metafields:

    • name : String
    • biography : HTML
    • image : Image

    Once you added the fields. Click Save Changes. Once you hit save, your custom object configuration page should look like the image below:

  • Now you need to create your author Custom Object instances. You do this by going back to the homepage and clicking Create/Modify Custom Object then clicking on Create new author under "author".

    Your data should look something like this

    Simply fill out the data you want for your author and click Save Changes. For this example. I am going to create one author. When complete, your Custom Object listing page should look like the following image.

  • Now that you have created your slides. All you have to do it associate them with the "First Post" Article. You can do this by navigating to the homepage, click on Add Metafields select articles then click Search and select First Post.

    Copy and paste the id of the author you created and paste it into the "author" metafield slot then click Save Metafields.

    When complete, the page should look like the following image.

  • If you scroll down, you'll see that several extra metafields have been added. These metafields are namespaced under 'author' since that was the custom object we associated to the article.

    Now all you have to do is embed the author metafields into the article.liquid template using the snippets listed. We created an example for you to download here. Be sure to include the snippet on your .liquid template by adding this line:

    {% include "mm-author" %}

    You can also view the snippet below: