Article

Article

clear(disableWarning)

Clear the article and create a new based on the configured base template.

Parameters

copy(name)

Attempt to execute copy hooks if at least one exists, then create a new, unsaved, article based on the current article.

Parameters

setSourceArticle(sourceArticleUuid)

Remove any itemMeta links with rel "source", and add a new itemMeta link with rel "source" using supplied article uuid

Parameters

setPubStatus(data)

Sets the publication status for this document. The value is one of what is defined in the NewsML G2 standard: https://www.iptc.org/std/NewsML-G2/latest/QuickStart-NewsML-G2-ItemBasics under the Publication Status section, together with custom extension in the format [customExtensionPrefix]:[customValue], such as imext:draft

Parameters

Example

import {api} from 'writer'

api.Article.setPubStatus({
     change: 'stat:withheld'
})

<itemMeta>
  <pubStatus qcode="stat:withheld"/>
</itemMeta>

addService(data)

Deprecated

Adds a service to the itemMeta section of the article. The service tag concists of a mandatory 'qcode' value and an optional 'why' attribute with extra information.

Parameters

Example

import {api} from 'writer'

api.article.addService({
    change: {
     qcode: "imchn:abc",
     why: "imext:main"
   }
});


<contentMeta>
    <service qcode="imchn:abc" why="imext:main"/>
</contentMeta>

removeService(data)

Removes a service from the itemMeta section of the article.

Parameters

Example

import {api} from 'writer'

api.article.removeService({
    change: "imchn:abc"
});

setPubStart(data)

Sets the publish start time, using ISO_8601 standard. If value is null, pubStart will be unset.

Parameters

Example

import {api} from 'writer'

api.article.setPubStart({
     'change': '2018-04-21T00:00:00+02:00'
  });
<itemMeta>
  <itemMetaExtProperty type="imext:pubstart" value="2018-04-21T00:00:00+02:00"/>
</itemMeta>

setPubStop(data)

Sets the publish stop time, using ISO_8601 standard.

Parameters

Example

import {api} from 'writer'

api.article.setPubStop({
     'change': '2018-04-21T00:00:00+02:00'
  });
<itemMeta>
  <itemMetaExtProperty type="imext:pubstop" value="2018-04-21T00:00:00+02:00"/>
</itemMeta>

setTitle(data)

Sets the value of the title.

Parameters

Example

import {api} from 'writer'

api.article.setTitle({
     "change": "Document title"
  });
<itemMeta>
  <title>Document title</title>
</itemMeta>

setEdNote(data)

Sets the value of editor note

Parameters

Example

import {api} from 'writer'

api.article.setEdNote({
     "change": "Instructions to editor"
  });
<itemMeta>
  <edNote>Instructions to editor</edNote>
</itemMeta>

setItemMetaExtProperty(data)

Sets the value of a property. If value is null, the property will be removed. The type of property to change is specified by the type argument.

The type is defined by the [customPrefix]:[type] syntax, such as imext:url

Parameters

Example

import {api} from 'writer'

api.article.setItemMetaExtProperty({
     "change": {
         type: "imext:haspublishedversion",
         value: "true"
     }
  });
<itemMeta>
  <itemMetaExtProperty type="imext:haspublishedversion" value="true"/>
</itemMeta>

Adds a link to the itemMeta section of the article.

Parameters

Example

import {api} from 'writer'

api.article.addItemMetaLink({
     change: {
         rel: "subject",
         title: "Mora",
         type: "x-im/category",
         uuid: "7b8461e8-4a22-11e8-aa12-b79c05b8e6d5",
         links: [
             {
                 rel: "broader",
                 title: "Dalarna",
                 uuid: "03d22994-91e4-11e5-8994-feff819cdc9f",
                 type: "x-im/category",
                 data: {
                     "placement": {
                         attributes: {
                             "type": "position"
                         },
                         value: "left"
                     }
                 }
             }
         ]
     }
  });

<itemMeta>
  <links>
      <link rel="subject" title="Mora" type="x-im/category" uuid="7b8461e8-4a22-11e8-aa12-b79c05b8e6d5">
          <links>
              <link rel="broader" title="Dalarna" uuid="03d22994-91e4-11e5-8994-feff819cdc9f" type="x-im/category">
                  <data>
                      <placement type="position>left</placement>
                  </data>
          </links>
      </link>
  </links>
</itemMeta>

Removes a link from itemMeta section

Parameters

Example

import {api} from 'writer'

api.article.removeItemMetaLink({
     change: {
         rel: 'subject',
         uuid: '320938f8-db94-11e5-b5d2-0a1d41d68578'
     }
  });

setAltId(data)

Deprecated

Sets the alternative ID for the article. If null, the element will be removed.

Parameters

Example

import {api} from 'writer'

api.article.setAltId({
     "change": "854575"
  });

<contentMeta>
  <altId>854575</altId>
</contentMeta>

setSlugline(data)

Deprecated

Sets the slugline for the article. If null, the element will be removed.

Parameters

Example

import {api} from 'writer'

api.article.setSlugline({
     "change": "This article is all about"
  });

<contentMeta>
  <slugline>This article is all about</slugline>
</contentMeta>

setDescription(data)

Deprecated

Sets the description of the article. If null, the element will be removed.

Parameters

Example

import {api} from 'writer'

api.article.setDescription({
     "change": "Description of the article"
  });

<contentMeta>
  <description>Description of the article</description>
</contentMeta>

setBy(data)

Deprecated

Sets the byline for the article. If null, the element will be removed.

Parameters

Example

import {api} from 'writer'

api.article.setBy({
     "change": "Boris Byline"
  });

<contentMeta>
  <by>Boris Byline</by>
</contentMeta>

setHeadline(data)

Deprecated

Sets the headline of the article. If null, the element will be removed.

Parameters

Example

import {api} from 'writer'

api.article.setHeadline({
     "change": "Article headline"
  });

<contentMeta>
  <headline>Article headline</headline>
</contentMeta>

Deprecated

Adds a link to the contentMeta section of the article.

Parameters

Example

import {api} from 'writer'

api.article.addContentMetaLink({
  change: {
    rel: "articlesource",
    title: "Online",
    type: "x-im/articlesource",
    uri: "im://articlesource/online"
  }
});

<contentMeta>
    <links>
        <link rel="articlesource" title="Online" type="x-im/articlesource" uri="im://articlesource/online"/>
    </links>
</contentMeta>

Deprecated

Removes a link from contentMeta section

Parameters

Example

import {api} from 'writer'

api.article.removeContentMetaLink({
     change: {
         rel: 'subject',
         uuid: '320938f8-db94-11e5-b5d2-0a1d41d68578'
     }
  });

addContentMetadata(data)

Deprecated

Adds an object element to the metadata section in contentMeta

Parameters

Example

import {api} from 'writer'

api.article.addContentMetadata({
    change: {
        id: "8400c74d667e",
        type: "x-im/teaser",
        title: "Sed sit amet turpis a purus fringilla",
        data: {
            subject: "In sodales lectus vel egestas rhoncus",
            text: "Duis eget magna lacus. In sodales lectus vel egestas rhoncus."
        }
        links: [
            {
                rel: "image",
                type: "x-im/image",
                uri: "im://image/znX8U1CU124n26zu7gb40_jBzSk.jpeg",
                uuid: "c382c937-8511-5d48-9677-55658c2bbb32",
                data: {
                    width: "1536",
                    height: "1024"
                }
            }
        ]
    }
})

<contentMeta>
    <metadata>
        <object id="8400c74d667e" type="x-im/teaser" title="Sed sit amet turpis a purus fringilla">
           <data>
               <subject>In sodales lectus vel egestas rhoncus</subject>
               <text>Duis eget magna lacus. In sodales lectus vel egestas rhoncus.</text>
           </data>
           <links>
               <link rel="image"
                         type="x-im/image"
                         uri="im://image/znX8U1CU124n26zu7gb40_jBzSk.jpeg"
                         uuid="c382c937-8511-5d48-9677-55658c2bbb32">
                   <data>
                       <width>1536</width>
                       <height>1024</height>
                   </data>
               </link>
           </links>
        </object>
    </metadata>
</contentMeta>

removeContentMetadata(data)

Deprecated

Removes an object in the contentMeta metadata section of the article.

Parameters

Example

import {api} from 'writer'

api.article.removeContentMetadata({
     change: {
         id: 'A8567B335'
     }
  });

itemMeta(path)⇒ DocumentNode

Returns the itemMeta node

Returns: DocumentNode - A node instance

Throws:

  • Error when node does not exist

Parameters

contentMeta(path)⇒ DocumentNode

Returns the contentMeta node

Returns: DocumentNode - A node instance

Throws:

  • Error when node does not exist

Parameters

Types

TimeChange: object

StringChange: object

LanguageChange

AddContentMetaObjectChange: object

RemoveContentMetaObjectChange: object

ExtTypeObjectChange: object

AddMetaLinkObjectChange: object

RemoveMetaLinkObjectChange: object