Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'untitled' when creating articles via script #75

Open
ComputerCarl opened this issue Jun 7, 2018 · 1 comment
Open

'untitled' when creating articles via script #75

ComputerCarl opened this issue Jun 7, 2018 · 1 comment

Comments

@ComputerCarl
Copy link

I am using the following in React to use NodeBB as comments. While the articles are created, the title of all is undefined. What are the proper variables to set to make this work properly?

function loadScript(src) {
  return new Promise(function (resolve, reject) {
    var s;
    s = document.createElement('script');
    s.src = src;
    s.onload = resolve(s);
    s.onerror = reject;
    document.head.appendChild(s);
  });
}


  componentDidMount() {
    const { articleID } = this.props;

    var nodeBBURL = 'https://mysite.xyz';
    let obj = {
      title_plain: 'this is page 2',
      url: 'http://mysite.xyz',
      tags: ['awesome'],
      markDownContent: 'Sometimes life can be **bold**.',
      cid: 5
    }
    window.articleID = articleID;
    // articleData is not being used; site title is `undefined`, no tags
    window.articleData = JSON.stringify(obj);
    window.nodeBBURL = nodeBBURL;
    loadScript(nodeBBURL + '/plugins/nodebb-plugin-blog-comments/lib/general.js')
  }

@ComputerCarl
Copy link
Author

Perhaps I should be using nodebb-plugin-write-api instead?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant