Skip to content

Instantly share code, notes, and snippets.

@stoppableforce
Last active March 14, 2022 12:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stoppableforce/8a9a99e5b965729236fd4dde89e2d056 to your computer and use it in GitHub Desktop.
Save stoppableforce/8a9a99e5b965729236fd4dde89e2d056 to your computer and use it in GitHub Desktop.
A 1999.io publishing callback that simply copies the published files into another place in the filesystem and corrects the URLs to remove my username and 1999's subdomain from the path. Sort of like blogging in "single user" mode in 1999.
var store = require ("/FULL/PATH/TO/1999/INSTALL/lib/store.js");
if (screenName == "stoppableforce") {
var newpath = "/BASE/FOLDER/TO/COPY/FILES/TO/" + relpath;
var pathCorrectedBody = body.split("configured.url.with/user/yourusername").join("shorter.snappier.url");
store.newObject(newpath, pathCorrectedBody, type);
}
/*
What needs to be personalized for this on your system:
/FULL/PATH/TO/1999/INSTALL/: the full path to your 1999 install. This should be the folder that contains
api.js, README.md, the lib subdirectory, the callbacks subdirectory, etc.
/BASE/FOLDER/TO/COPY/FILES/TO/: the folder you want to copy your files to. Published files will appear in this
directory and folders under it.
example: /BASE/FOLDER/TO/COPY/FILES/TO/2016/04/03/0030.html
configured.url.with/user/yourusername: the long published page URL that 1999 automatically assigns to your
pages.
example: 1999.yourdomain.com/user/yourtwitterhandle
shorter.snappier.url: exactly what it says on the tin. example: yourdomain.com
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment