App-org2wp

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

NAME
    App::org2wp - Publish Org document (or heading) to WordPress as blog
    post

VERSION
    This document describes version 0.013 of App::org2wp (from Perl
    distribution App-org2wp), released on 2022-05-02.

FUNCTIONS
  org2wp
    Usage:

     org2wp(%args) -> [$status_code, $reason, $payload, \%result_meta]

    Publish Org document (or heading) to WordPress as blog post.

    This is originally a quick hack because I couldn't make
    L<https://github.com/punchagan/org2blog> on my Emacs installation to
    work after some update. "org2wp" uses the same format as "org2blog", but
    instead of being an Emacs package, it is a CLI script written in Perl.

    First, create "~/org2wp.conf" containing the API credentials, e.g.:

     ; use INI (IOD) format for this file
     proxy=https://YOURBLOGNAME.wordpress.com/xmlrpc.php
     username=YOURUSERNAME
     password=YOURPASSWORD

    Note that "proxy" is the endpoint URL of your WordPress instance's
    XML-RPC server, which can be hosted on "wordpress.com" or on other
    server, including your own. It has nothing to do with HTTP/HTTPS proxy;
    the term "proxy" is used by the XMLRPC::Lite and SOAP::Lite Perl
    libraries and "org2wp" simply uses the same terminology.

    You can also put multiple credentials in the configuration file using
    profile sections, e.g.:

     ; use INI (IOD) format for this file
     [profile=blog1]
     proxy=https://YOURBLOG1NAME.wordpress.com/xmlrpc.php
     username=YOURUSERNAME
     password=YOURPASSWORD
 
     [profile=blog2]
     proxy=https://YOURBLOG2NAME.wordpress.com/xmlrpc.php
     username=YOURUSERNAME
     password=YOURPASSWORD

    and specify which profile you want using command-line option e.g.
    "--config-profile blog1".

   Document mode
    You can use the whole Org document file as a blog post (document mode)
    or a single heading as a blog post (heading mode). The default is
    document mode. To create a blog post, write your Org document (e.g. in
    "post1.org") using this format:

     #+TITLE: Blog post title
     #+CATEGORY: cat1, cat2
     #+TAGS: tag1,tag2,tag3
 
     Text of your post ...
     ...

    then:

     % org2wp post1.org

    this will create a draft post. To publish directly:

     % org2wp --publish post1.org

    Note that this will also modify your Org file and insert this setting
    line at the top:

     #+POSTID: 1234
     #+POSTTIME: [2020-09-16 Wed 11:51]

    where 1234 is the post ID retrieved from the server when creating the
    post, and post time will be set to the current local time.

    After the post is created, you can update using the same command:

     % org2wp post1.org

    You can use "--publish" to publish the post, or "--no-publish" to revert
    it to draft.

    To set more attributes:

     % org2wp post1.org --comment-status open \
         --extra-attr ping_status=closed --extra-attr sticky=1

    Another example, to schedule a post in the future:



( run in 0.495 second using v1.01-cache-2.11-cpan-71847e10f99 )