-
Notifications
You must be signed in to change notification settings - Fork 73
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
Images and other files support #15
Comments
This is tough, since org-static-blog currently does not care about static files at all. I usually use relative paths, and don't care about them being broken in org-mode. Maybe we should add an Or maybe it would be best to just handle this locally, by symlinking your assets directory into both, the posts directory and the publish directory. This should work, and would not require a change in |
currently what I'm doing FWIW |
If someone runs into this w/ static files that need copying, this is what I'm doing. I have a few things like css files, favicons, etc that I need moved. The tangle of the main emacs.org will output my blog settings as elisp as well as some static files (like css). Then I use that to actually do the publish. help:
@echo "You want to pick one of the options. publish or tangle"
tangle:
emacs --no-init-file --batch \
--eval "(require 'package)"\
--eval "(add-to-list 'package-archives '(\"melpa\" . \"http://melpa.org/packages/\") t)"\
--eval "(package-initialize)"\
--eval "(package-refresh-contents nil)"\
--eval "(package-install 'org)"\
--eval "(package-install 'lua-mode)" \
--eval "(package-install 'toml-mode)" \
--eval '(setq comment-start "#")' \
--eval "(require 'org)" \
--eval "(require 'lua-mode)" \
--eval "(require 'toml-mode)" \
--eval '(org-babel-tangle-file "./_posts/dotfiles/emacs.org")'
publish: tangle
emacs --batch --no-init-file \
--eval "(setq blog-root \"`pwd`\")" \
--load ~/.config/emacs/static-blog.el \
--eval '(message "publishing...")' \
--eval '(org-static-blog-publish t)' \
--eval '(message "...done")'
./copy-static-dirs.sh copy-static-dirs.sh #!/usr/bin/env bash
set -x
# Used to copy files over to the blog publishing location b/c org-static-blog
# doesn't support static blog-specific files
PUBLISH_DIR=$(emacs --batch --no-init-file --load ~/.config/emacs/static-blog.el --eval "(princ org-static-blog-publish-directory)" 2>/dev/null)
cp -vR ./static/ $PUBLISH_DIR/ |
Right now when I add an image in a post via org-mode markup:
I get:
Which is... broken because the path is relative to
org-static-blog-posts-directory
and notorg-static-blog-publish-directory
.I do not want to write my blog post with relative links to
org-static-blog-publish-directory
because it would break the file search to insert files as well as image previews.A simple way to solve this (by no mean the only one nor the best) would be to copy (or link ?) files from
org-static-blog-post-directory
toorg-static-blog-publish-directory
if they match a given patttern (*.png, *.jpg, *.svg... we make the exact pattern a customize option).What do you think ?
The text was updated successfully, but these errors were encountered: