So I'm trying to create some updatable content sections from the Settings page which are then output on the homepage, in a sidebar. Just some simple text-based sections for, say, community announcements.

I figure this is possible, and I've had success copying the code from the sample project to create the custom field – the problem I'm having is in outputting it. I know that it needs to be on a post template, but even in that case, I'm not able to get the data to out put.

Here's the code I'm using:

In custom_fields.js:

Settings.addField({
  fieldName: "customSettingsField",
  fieldSchema: {
    type: String,
    optional: true,
    autoform: {
      group: "customGroup"
    }
  }
});

In custom_main_posts_list.html:

<template name="custom_main_posts_list">
<div class="main-posts-list">
    {{> modules zone="postsListTop"}}
    {{#if customTemplate}}
    {{> Template.dynamic template=customTemplate data=arguments}}
    {{else}}
    {{> posts_list_controller arguments}}
    {{/if}}
    {{> modules zone="postsListBottom"}}
</div>
<div class="custom_field">{{customSettingsField}}</div>
</template>

I'm sure it's simple, but I'm flummoxed!

Comments

Thanks so much Sasha! That worked great. And yes, I need to learn more about Meteor in general for sure – thanks again.

Reply
Sacha GreifSacha Greif
last year

Settings have their own helper: Settings.get("nameOfSetting"). (edit: or inside a template: {{getSetting "nameOfSetting"}}

Beyond that I suggest reading up on Meteor and Blaze in general, it'll be a big help to understand how Telescope works :)

Reply