Skip to main content
Glama

create_content

Create new content items in LightCMS using templates, with support for wikilinks, snippets, hashtags, and Markdown to build structured website pages.

Instructions

Create a new content item. Requires a template_id, title, slug, and the data fields defined by the template.

Workflow:

  1. Call list_templates to find the right template and its field names.

  2. Create the content with data matching those fields.

  3. Call publish_content to make it live (or set published=true here to do both in one step).

Set use_header=true, use_footer=true, use_theme=true for pages that should use the site layout. Always include version_comment to make history readable.

Content data fields support rich markup features:

  • [[Wikilinks]] and [[Page Title|display text]] — link to other pages by title or path; auto-update when paths change

  • [[include:snippet-name]] — embed a named snippet inline (reusable callouts, CTAs, disclaimers)

  • #hashtags — mention #tagname anywhere to automatically tag the page

  • Markdown fields (type "markdown") — GitHub Flavored Markdown converted to HTML at publish time Templates can use {{.lc_toc}} in their HTML layout to inject an auto-generated table of contents.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
categoryNoContent category for collections
dataYesTemplate field values,required
folder_pathNoFolder path (e.g., /blog)
meta_descriptionNoSEO meta description
og_imageNoOpen Graph image URL
publishedNoPublish immediately
raw_modeNoUse raw HTML mode
slugYesURL slug for the content,required
tagsNoTags for lc:query index pages (e.g. ['AI & Machine Intelligence', 'Generative AI'])
template_idYesTemplate ID (MongoDB ObjectID),required
titleYesContent title,required
use_footerNoInclude site footer
use_headerNoInclude site header
use_themeNoApply site theme/layout
version_commentNoOptional comment describing this version

Implementation Reference

  • The handleEvent function processes chat events, including 'token' (streaming response) and 'sources' (retrieved context). It dynamically updates the UI to display the generated answer and links to sources.
    function handleEvent(evt) {
      if (evt.type === 'token' && evt.text) {
        rawAnswer += evt.text;
        ensureAnswer().innerHTML = renderMarkdown(rawAnswer);
        body.scrollTop = body.scrollHeight;
      } else if (evt.type === 'sources') {
        removeLoading();
        var results = evt.results || [];
        if (results.length === 0 && !answerEl) {
          body.innerHTML = '<p class="lc-no-results">No results found. Try rephrasing your question.</p>';
          return;
        }
        if (results.length > 0) {
          sourcesEl = document.createElement('div');
          sourcesEl.className = 'lc-sources';
          var html = '<div class="lc-sources-label">Sources</div>';
          for (var i = 0; i < results.length; i++) {
            var r = results[i];
            html += '<a class="lc-result" href="' + escHtml(r.url) + '">' +
              '<span class="lc-result-arrow">↗</span>' +
              '<span class="lc-result-title">' + escHtml(r.title) + '</span>' +
              '</a>';
          }
          sourcesEl.innerHTML = html;
          body.appendChild(sourcesEl);
          body.scrollTop = body.scrollHeight;
        }
      } else if (evt.type === 'done') {
        sendBtn.disabled = false;
        input.value = '';
        input.focus();
      }
    }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/jonradoff/lightcms'

If you have feedback or need assistance with the MCP directory API, please join our Discord server