We've retired the forum in favor of GitHub Discussions.

New conversations can be started on GitHub. Existing conversations will remain for a while longer.

Head over to GitHub →

Using {{ content }} inside of replicator?

Aaron Sagray November 23, 2014 by Aaron Sagray

I'm trying to build an articles page, which would display blocks of interactive media in the flow of the main story – similar to the Snow Fall article at NYT.

The Replicator concept seems to be failing me. I has hoped it would allow me to augment the content area with additional media, but that appears not to be the case. No content from existing blog posts appears in the {{ content }} tag when I use it as I'd like to:

Here's the template code I have:

<article class="post">
    <section>
    <h6>{{ date }}</h6>
    <h1>{{ title|smartypants|widont }}</h1>
    </section>
    {{ post_replicator }}
        {{ if type=="content_set"}}
            <section>
                {{ content }}
            </section>
        {{ elseif type=="callout_set" }}
            <section>
                #Interactive Stuff here
            </section>
        {{ elseif type=="img_set" }}
            <section>
                               #Interactive Stuff here
            </section>
        {{ endif}}
    {{ /post_replicator }}
</article>

And my template fields

fields:
## Metadata for post
  categories:
    display: Categories
    required: false
    default:
    type: tags
  meta_section:
    type: section
    display: Post Content
    instructions: Write an awesome post

## Replicator for Content
  post_replicator:
    type: replicator
    instructions: |
      Replicate a new set for each piece of content you need.

    sets:
## Replicator sets echoed in template
      ##Content
      content_set:
        display: Content (Markdown)
        fields:
          content:
            display: Text
            type: markitup

      ##Fancy Call outs
      callout_set:
        display: Callout
        fields:
          quote:
            type: textarea
            height: 40
            instructions: What was said?
          cite:
            type: text
            instructions: Who said it?

      ##Image with Caption
      img_set:
        display: Image
        fields:
          photo:
            type: file
            allowed: [png, jpg, gif]
            destination: assets/img/
          caption:
            type: text
            instructions: Describe the photo

hide: true
Answered by Jason Varga!
>>>>>>> Answered <<<<<<<
3 Replies
2 Followers