A manual option would be to go to $:/AdvancedSearch, type in the filter you
want to export (e.g., [tag[Public]] [is[system]]), use the export button to
the right of the search box to export as JSON, and then import that JSON
file into a fresh empty.html and publish that HTML file.
That said, since you are already using Node.js, automating this with
"command-line voodoo" isn't that hard, and then it will do everything for
you with one command, without a chance of making mistakes. Here's a
simplified version of what I use. I'm guessing you're using Windows, but if
so and you have github.io set up, you probably already have Git for Windows
installed, which will be enough to run a Bash script like the one below.
Mac/Linux will run this script out of the box.
Wherever you keep your wiki, your folder tree should look like this:
My Zettelkasten
|- zk-wiki
|- public-wiki
|- scripts
|- publish.sh
...where publish.sh is the script below, and public-wiki is an empty folder
that your public wiki will be built into. If you don't like "zk-wiki" or
"public-wiki" as names, you can change them in the constants block just
below.
#!/bin/bash
### Change these constants to taste. (Don't remove the quotation marks at
the beginning and end of any value.) ###
PRIV_FOLDER="zk-wiki"
PUB_FOLDER="public-wiki"
FILT='[is[system]] [tag[Public]] -[[$:/plugins/tiddlywiki/tiddlyweb]]
-[[$:/plugins/tiddlywiki/filesystem]] -[prefix[$:/temp]]
-[prefix[$:/state]] -[prefix[$:/sib/StorySaver/saved]]
+[!field:title[$:/sib/WriteSideBar]]'
WIKI_NAME="index.html"
ext_image_folder="extimage"
### Various sanity checks to ensure we're able to start building the wiki
without breaking anything. ###
pub_wiki="${PUB_FOLDER:?eek}/wiki"
pub_ghpages="${PUB_FOLDER:?eek}/pages"
die() {
ret=$?
printf "%s\\n" "$@" >&2
exit $ret
}
cd "$(dirname "$0")/.." || die "Script in unexpected location. Please check
script."
[ -f "package.json" ] || die "cd to project root failed. Please check
script."
### Do the build. ###
echo "Exporting public tiddlers..."
rm -rf "$pub_wiki"
"$(npm bin)/tiddlywiki" "$PRIV_FOLDER" --savewikifolder "$pub_wiki" "$FILT"
echo "Externalizing images..."
"$(npm bin)/tiddlywiki" "$pub_wiki" --savetiddlers "[is[image]]"
"$ext_image_folder"
# Note: images are saved here but aren't replaced with references until
next command.
echo "Compiling single HTML file..."
"$(npm bin)/tiddlywiki" "$pub_wiki" \
--setfield "[is[image]]" _canonical_uri
'$:/core/templates/canonical-uri-external-image' text/plain \
--setfield "[is[image]]" text "" text/plain \
--render "$:/core/save/all" "$WIKI_NAME" text/plain
cp -r "$pub_wiki/output"/* "$pub_ghpages"
### Publish built wiki to the web. ###
if [ "$1" = "--push" ]; then
echo "Pushing compiled wiki to GitHub..."
cd "$pub_ghpages" || exit 1
git add .
git commit -m "publish checkpoint"
git push
else
echo "Not pushing the wiki to GitHub because the --push switch was not
provided."
fi
Once you have this file created, go into your *My Zettelkasten* folder,
open Git Bash, and type the following to make your script executable and
clone your GitHub Pages repository to a location where the script can find
it:
chmod +x scripts/publish.sh
mkdir public-wiki
cd public-wiki
git clone https://your/repository/clone/url pages
After initial setup, whenever you want to publish, you just start Git Bash
in the *My Zettelkasten* folder and say:
scripts/publish.sh --push
On Sunday, April 18, 2021 at 5:54:03 AM UTC-5 ludwa6 wrote:
> Cool -editor works fine now- so i've make this my personal github.io repo
> <https://ludwa6.github.io/>, where i'll try to document my journey of
> learning with Zettelkasten as i go. Have not yet found a good way to
> export just the Public (i.e. not tagged "private") tiddlers for push to
> Github; was kinda hoping the standard "export all" tool might serve for
> that purpose, but it seems not. If anyone can suggest a good low-friction
> workflow for this (ideally w/o any command line voodoo involved :-), i'd be
> much obliged!
>
> /walt
>
> On Sunday, April 18, 2021 at 12:18:53 AM UTC+1 Soren Bjornstad wrote:
>
>> Haha, sorry, I forgot to turn off the vim keybindings. PMario has
>> explained how to do that.
>>
>> On Saturday, April 17, 2021 at 1:30:57 PM UTC-5 ludwa6 wrote:
>>
> OK, after struggling w/ this a bit, i have to stop and ask: is there
>>> something that would cause the editor widget to behave very differently
>>> from standard TW5?...
>>
>>
>>> On Saturday, April 17, 2021 at 6:06:29 PM UTC+1 Soren Bjornstad wrote:
>>>
>> The public version lacks some functionality that is important for editing
>>>> and has a bunch of settings changed that are a bit of a pain to change
>>>> back, so it'll be much better if I do a second build off of the "real"
>>>> private version. I've attached a first 15-minute attempt at this.
>>>>
>>>> Things that could use improvement here:
>>>>
>>>> - There are no instructions at all, so you'll have to figure out
>>>> how to get started on your own. Some of the conventions tiddlers are
>>>> missing and would be nice to have.
>>>> - I included all the red, yellow, and black tag tiddlers, but since
>>>> there is no content in this version, most of them are not tagging
>>>> anything,
>>>> so they don't show up in the tags list. Also, some of the tag tiddlers
>>>> have
>>>> content that probably won't be very useful for you in them.
>>>> - There's a button for the ReadingInbox on the toolbar, but said
>>>> inbox is not included in the edition at present. You can hide or delete
>>>> that button tiddler.
>>>>
>>>> Please let me know what else does not work right – I'd love to add a
>>>> build of this edition to my standard publish process in the future....
>>>>
>>>
--
You received this message because you are subscribed to the Google Groups
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywiki/1529a8e0-a3b0-46bb-81ed-cc20c1a17ac6n%40googlegroups.com.