ardumont / org2jekyll Goto Github PK
View Code? Open in Web Editor NEWBlogging with org-mode and jekyll without alien yaml headers.
License: GNU General Public License v2.0
Blogging with org-mode and jekyll without alien yaml headers.
License: GNU General Public License v2.0
hi,
I'm toying around with jekyll / org2jekyll but I’ve not been able to publish images easily from orgmode. The only way I managed to publish images is by placing all of them in top level directory of jekyll and put relative paths in orgmode like this :
[[../../../../../images/test_r.png]]
I strongly guess I’ve missed something somewhere (doing like this I can't see the images from orgmode, which is annoying). Would you mind explaining the correct way to deal with images in terms of paths ? Thanks.
I try to use org2jekyll with R code blocks which produce a plot and want that the images are inlined in the html page produced by jekyll.
I get it working to have images generated in the right place, so in the "img" folder, like this:
#+begin_src R :results output graphics :exports both :file img/fig.png
plot(iris)
#+end_src
But the the org2jekyll functions produces html file with a relative link as well, which does not work for the produced static pages, as the 'img' folder is not in the subfolder-per-day, but in main folder.
I am not sure, if there is something to configure in emacs/jekyll or if it is not supported.
I am a newbie regarding jekyyll and org publishing in general.
It does work to create an additional link by hand in the org file, such as, but this is more a workarround.
[[file:/img/fig.png]]
Any help would be appreciated.
Yes, I'm afraid so. It could also be me.
System information:
- system-type: darwin
- locale-coding-system: utf-8-unix
- emacs-version: GNU Emacs 26.3 (build 1, x86_64-apple-darwin18.2.0, NS appkit-1671.20 Version 10.14.3 (Build 18D109))
of 2019-09-02
- org version: 9.1.9
- org2jekyll version: 0.2.5
- org2jekyll path: /Users/robertpostill/software/emacs-config/.cask/26.3/elpa/org2jekyll-20200521.1656/org2jekyll.el"
When publishing a blog post I would expect that the blog post comes out an entire post. This has previously worked for me.
The HTML file appears in the _posts directory but is missing the front matter for Jekyll to process.
Also (I don't know if this is related) but org files appear with the date in them in my org dir. I will take that to a separate issue if that's not relevant to this issue.
So here's the top of my org file:
#+STARTUP: showall
#+STARTUP: hidestars
#+OPTIONS: H:2 num:nil tags:t toc:nil timestamps:t
#+LAYOUT: post
#+AUTHOR: robertpostill
#+DATE: 2020-05-25 Mon 22:06
#+TITLE: Planning To Add Auth - Part 2 - Fixing the package
#+DESCRIPTION: The yak shave is now in full swing, can I fix the mongodb driver so the previous functionality works again?
#+TAGS: racket testing mongodb yak-shaving
#+CATEGORIES: racket authentication yak-shaving monogdb
* I've just joined, what happened?
Here's the top of the HTML file:
<div id="outline-container-org324fd50" class="outline-2">
<h2 id="org324fd50">I've just joined, what happened?</h2>
<div class="outline-text-2" id="text-org324fd50">
M-x org2jekyll-publish-posts
How can we try and reproduce?
Relevant bit of my init.el
'(org2jekyll-blog-author "robertpostill")
'(org2jekyll-jekyll-directory (expand-file-name "~/software/robertpostill.github.io/"))
'(org2jekyll-jekyll-drafts-dir "")
'(org2jekyll-jekyll-posts-dir "_posts/")
'(org2jekyll-source-directory
(expand-file-name "~/software/robertpostill.github.io/org/"))
'(org-publish-project-alist
(\`
(("default" :base-directory
(\,
(org2jekyll-input-directory))
:base-extension "org" :publishing-directory
(\,
(org2jekyll-output-directory))
:publishing-function org-html-publish-to-html :headline-levels 4 :section-numbers nil :with-toc nil :html-head "<link rel=\"stylesheet\" href=\"./css/style.css\" type=\"text/css\"/>" :html-preamble t :recursive t :make-index t :html-extension "html" :body-only t)
("post" :base-directory
(\,
(org2jekyll-input-directory))
:base-extension "org" :publishing-directory
(\,
(org2jekyll-output-directory org2jekyll-jekyll-posts-dir))
:publishing-function org-html-publish-to-html :headline-levels 4 :section-numbers nil :with-toc nil :html-head "<link rel=\"stylesheet\" href=\"./css/style.css\" type=\"text/css\"/>" :html-preamble t :recursive t :make-index t :html-extension "html" :body-only t)
("images" :base-directory
(\,
(org2jekyll-input-directory "img"))
:base-extension "jpg\\|gif\\|png" :publishing-directory
(\,
(org2jekyll-output-directory "img"))
:publishing-function org-publish-attachment :recursive t)
("js" :base-directory
(\,
(org2jekyll-input-directory "js"))
:base-extension "js" :publishing-directory
(\,
(org2jekyll-output-directory "js"))
:publishing-function org-publish-attachment :recursive t)
("css" :base-directory
(\,
(org2jekyll-input-directory "css"))
:base-extension "css\\|el" :publishing-directory
(\,
(org2jekyll-output-directory "css"))
:publishing-function org-publish-attachment :recursive t)
("web" :components
("images" "js" "css")))))
add it into org2jekyll.el, and it can use when org file export to html file.
---
layout: post
title: Custom Color Scheme
category: note
tags: curtana
scheme-text: "#0029ff" <<<--here
scheme-link: "#ff00b4" ...
scheme-hover: "#ff00b4" ...
scheme-code: "#ad00ff" ...
scheme-bg: "#00ebff" ...
scheme-hero-text: "#00ebff" ...
scheme-hero-link: "#00ebff" ...
scheme-hero-bg: "#0029ff" ...
plugin: lightense ---until here>>>
---
I use the Super-fast Jekyll framework for Github blog, Almace Scaffolding. It need this Markdown Head.
the address is :
http://sparanoid.com/lab/amsf/
Thank you for your help!
Thank you for your last replay!
Today I study the "monkey patch", and I DO step by step like this:
1rt step:
I paste the patch to my "~/.emacs.d/init.d/blog-pack.el":
(custom-set-variables '(org2jekyll-extra-yaml-headers "scheme-text: \"#0029ff\"
scheme-link: \"#ff00b4\"
scheme-hover: \"#ff00b4\"
scheme-code: \"#ad00ff\"
scheme-bg: \"#00ebff\"
scheme-hero-text: \"#00ebff\"
scheme-hero-link: \"#00ebff\"
scheme-hero-bg: \"#0029ff\"
plugin: lightense"))
2nd step:
Press "Alt+Shift+;", then mini buffer appear the word "Eval:", then I paste that two patches what you give me,
(defcustom org2jekyll-extra-yaml-headers nil
"An entry of static yaml header (already formatted).
E.g. from https://github.com/ardumont/org2jekyll/issues/34#issue-148684715:
scheme-text: \"#0029ff\"
scheme-link: \"#ff00b4\"
scheme-hover: \"#ff00b4\"
scheme-code: \"#ad00ff\"
scheme-bg: \"#00ebff\"
scheme-hero-text: \"#00ebff\"
scheme-hero-link: \"#00ebff\"
scheme-hero-bg: \"#0029ff\"
plugin: lightense"
:group 'org2jekyll)
(defun org2jekyll--to-yaml-header (org-metadata)
"Given a list of ORG-METADATA, compute the yaml header string."
(-let (((begin end) (if (org2jekyll--old-org-version-p)
'("#+BEGIN_HTML" "#+END_HTML\n")
'("#+BEGIN_EXPORT HTML" "#+END_EXPORT\n"))))
(--> org-metadata
org2jekyll--org-to-yaml-metadata
(--map (format "%s: %s" (car it) (cdr it)) it)
(cons "---" it)
(cons begin it)
(-snoc it org2jekyll-extra-yaml-headers)
(-snoc it "---")
(-snoc it end)
(s-join "\n" it)
(s-replace "\n\n" "\n" it))))
3nd step:
I built an "org" file:
#+STARTUP: showall
#+STARTUP: hidestars
#+OPTIONS: H:2 num:nil tags:nil toc:nil timestamps:t
#+LAYOUT: post
#+AUTHOR: yefeiyu
#+DATE: 2016-04-18 一 15:14
#+TITLE: try
#+DESCRIPTION:
#+TAGS:
#+CATEGORIES:
* try
4rd step:
M-x org2jekyll-publish
5th step:
Then It created a file of "2016-04-16-try.html",
---
layout: post
title: try
date: 2016-04-18
categories:
-
tags:
-
author: yefeiyu
excerpt:
---
<div id="outline-container-sec-1" class="outline-2">
<h2 id="sec-1">one</h2>
<div class="outline-text-2" id="text-1">
<p>
try<br >
</p>
</div>
</div>
6th step:
I didn't find the HEAD of "scheme-text ......", I had to paste it.
What's wrong with me ?
Although your patches are close to my target, but my goal is :
1, Input the "scheme-text ...." in ".org" file;
2, Create the ".html" file with backgroud color, text color and link color.
(btw: My last issue lack of "#ff3dss", only because I want fill the vacant position at every post, so the every article has it own color.
My english is poor, I am sorry.)
Thank you!
Hi!
Firstly, thank you for your org2jekyll. I like it very much.
Now, I have one quesstion.
when I use the function org2jekeyll-create-draft, then input some information about the blog.
the file's default path is /my-project-path/_post/nil.
Can I change it ? if yes, then how to change it ?
thank you very much.
hello!
Now I want to add a tags to my yaml header.
I have tries to add it by myself, But I had a little problem .
when I write a test.org , then org2jekyll-publish. I get one problem.
#+STARTUP: showall
#+STARTUP: hidestars
#+OPTIONS: H:2 num:nil tags:nil toc:nil timestamps:t
#+LAYOUT: post
#+AUTHOR: name
#+DATE: 2015-07-14 Tue 00:11
#+TITLE: C language
#+DESCRIPTION: C language
#+TAGS: C language(tags)
#+CATEGORIES: technology
after org2jekyll-publish
---
layout: post
title: C language
date: 2015-07-14
categories:
- technology
nil: <<<<<<<<<<<<attention
- C language(tags)
author: name
excerpt: C language
---
How could I resolve this problem.
my lisp code;
;;; Code:
(require 'org)
(require (if (version< emacs-version "24.4") 'org-publish 'ox-publish))
(require 'dash)
(require 's)
(require 'deferred)
(defgroup org2jekyll nil "Publish org-mode posts to jekyll"
:tag "org2jekyll"
:version "0.0.3"
:group 'org)
(defcustom org2jekyll-blog-author nil
"Blog entry author."
:type 'string
:require 'org2jekyll
:group 'org2jekyll)
(defalias 'org2jekyll/blog-author 'org2jekyll-blog-author) ;; for compatibility
(defcustom org2jekyll-source-directory nil
"Path to the source directory."
:type 'string
:require 'org2jekyll
:group 'org2jekyll)
(defalias 'org2jekyll/source-directory 'org2jekyll-source-directory)
(defcustom org2jekyll-jekyll-directory nil
"Path to Jekyll blog."
:type 'string
:require 'org2jekyll
:group 'org2jekyll)
(defalias 'org2jekyll/jekyll-directory 'org2jekyll-jekyll-directory)
(defcustom org2jekyll-jekyll-drafts-dir nil
"Relative path to drafts directory."
:type 'string
:require 'org2jekyll
:group 'org2jekyll)
(defalias 'org2jekyll/jekyll-drafts-dir 'org2jekyll-jekyll-drafts-dir)
(defcustom org2jekyll-jekyll-posts-dir nil
"Relative path to posts directory."
:type 'string
:require 'org2jekyll
:group 'org2jekyll)
(defalias 'org2jekyll/jekyll-posts-dir 'org2jekyll-jekyll-posts-dir)
(defvar org2jekyll-jekyll-post-ext ".org"
"File extension of Jekyll posts.")
(defvar org2jekyll-jekyll-org-post-template nil
"Default template for org2jekyll draft posts.
The `'%s`' will be replaced respectively by name, the author, the generated date, the title, the description and the categories.")
(setq org2jekyll-jekyll-org-post-template
"#+STARTUP: showall\n#+STARTUP: hidestars\n#+OPTIONS: H:2 num:nil tags:nil toc:nil timestamps:t\n#+LAYOUT: %s\n#+AUTHOR: %s\n#+DATE: %s\n#+TITLE: %s\n#+DESCRIPTION: %s\n#+TAGS: %s\n#+CATEGORIES: %s\n\n")
(defun org2jekyll--optional-folder (folder-source &optional folder-name)
"Compute the folder name from a FOLDER-SOURCE and an optional FOLDER-NAME."
(format "%s/%s" folder-source (if folder-name folder-name "")))
(defun org2jekyll-input-directory (&optional folder-name)
"Compute the input folder from the FOLDER-NAME."
(org2jekyll--optional-folder org2jekyll-source-directory folder-name))
(defun org2jekyll-output-directory (&optional folder-name)
"Compute the output folder from the optional FOLDER-NAME."
(org2jekyll--optional-folder org2jekyll-jekyll-directory folder-name))
(defun org2jekyll--make-slug (s)
"Turn a string S into a slug."
(replace-regexp-in-string
" " "-" (downcase
(replace-regexp-in-string
"[^A-Za-z0-9 ]" "" s))))
(defun org2jekyll--yaml-escape (s)
"Escape a string S for YAML."
(if (or (string-match ":" s)
(string-match "\"" s))
(concat "\"" (replace-regexp-in-string "\"" "\\\\\"" s) "\"")
s))
(defun org2jekyll-now ()
"Generate a formatted now date."
(format-time-string "%Y-%m-%d %a %H:%M"))
(defun org2jekyll-default-headers-template (blog-layout blog-author post-date post-title post-description post-tags post-categories)
"Compute default headers.
BLOG-LAYOUT is the layout of the post.
BLOG-AUTHOR is the author.
POST-DATE is the date of the post.
POST-TITLE is the title.
POST-DESCRIPTION is the description.
POST-TAGS is the tags
POST-CATEGORIES is the categories."
(format org2jekyll-jekyll-org-post-template blog-layout blog-author post-date (org2jekyll--yaml-escape post-title) post-description post-tags post-categories))
;;;###autoload
(defun org2jekyll-create-draft ()
"Create a new Jekyll blog post with TITLE."
(interactive)
"The `'%s`' will be replaced respectively by the blog entry name, the author, the generated date, the title, the description and the categories."
(let ((author org2jekyll-blog-author)
(date (org2jekyll-now))
(layout (read-string "Layout (post, default, ...): "))
(title (read-string "Title: "))
(description (read-string "Description: "))
(tags (read-string "Tags: "))
(categories (read-string "Categories (comma separated entries): ")))
(let ((draft-file (concat (org2jekyll-input-directory org2jekyll-jekyll-drafts-dir)
title
org2jekyll-jekyll-post-ext)))
(if (file-exists-p draft-file)
(find-file draft-file)
(progn (find-file draft-file)
(insert (org2jekyll-default-headers-template layout author date title description tags categories))
(insert "* "))))))
(defalias 'org2jekyll/create-draft! 'org2jekyll-create-draft)
;;;###autoload
(defun org2jekyll-list-posts ()
"Lists the posts folder."
(interactive)
(find-file (org2jekyll-output-directory org2jekyll-jekyll-posts-dir)))
(defalias 'org2jekyll/list-posts 'org2jekyll-list-posts)
;;;###autoload
(defun org2jekyll-list-drafts ()
"Lists the drafts folder."
(interactive)
(find-file (org2jekyll-output-directory org2jekyll-jekyll-drafts-dir)))
(defalias 'org2jekyll/list-drafts 'org2jekyll-list-drafts)
(defun org2jekyll-get-option-at-point (opt)
"Gets the header value of the option OPT from a buffer."
(let* ((regexp (org-make-options-regexp (list (upcase opt) (downcase opt)))))
(save-excursion
(goto-char (point-min))
(if (re-search-forward regexp nil t 1)
(match-string-no-properties 2)))))
(defun org2jekyll-get-option-from-file (orgfile option)
"Return the ORGFILE's OPTION."
(with-temp-buffer
(when (file-exists-p orgfile)
(insert-file-contents orgfile)
(goto-char (point-min))
(org2jekyll-get-option-at-point option))))
(defun org2jekyll-get-options-from-file (orgfile options)
"Return the ORGFILE's OPTIONS."
(with-temp-buffer
(when (file-exists-p orgfile)
(insert-file-contents orgfile)
(mapcar (lambda (option)
(save-excursion
(goto-char (point-min))
(cons option (org2jekyll-get-option-at-point option))))
options))))
(defun org2jekyll-layout (org-file)
"Determine if the current ORG-FILE's layout.
Depends on the metadata header #+LAYOUT."
(org2jekyll-get-option-from-file org-file "layout"))
(defalias 'org2jekyll-article-p 'org2jekyll-layout)
(defvar org2jekyll-map-keys '(("title" . "title")
("categories" . "categories")
("tags" . "tags")
("date" . "date")
("description" . "excerpt")
("author" . "author")
("layout" . "layout"))
"Keys to map from org headers to jekyll's headers.")
(defun org2jekyll--org-to-yaml-metadata (org-metadata)
"Given an ORG-METADATA map, return a yaml one with transformed data."
(--map `(,(assoc-default (car it) org2jekyll-map-keys) . ,(cdr it)) org-metadata))
(defun org2jekyll--convert-timestamp-to-yyyy-dd-mm (timestamp)
"Convert org TIMESTAMP to ."
(format-time-string "%Y-%m-%d"
(apply 'encode-time (org-parse-time-string timestamp))))
(defun org2jekyll--to-yaml-header (org-metadata)
"Given a list of ORG-METADATA, compute the yaml header string."
(--> org-metadata
org2jekyll--org-to-yaml-metadata
(--map (format "%s: %s" (car it) (cdr it)) it)
(cons "---" it)
(cons "#+BEGIN_HTML" it)
(-snoc it "---")
(-snoc it "#+END_HTML\n")
(s-join "\n" it)))
(defun org2jekyll--categories-csv-to-yaml (categories-csv)
"Transform a CATEGORIES-CSV entries into a yaml entries."
(->> categories-csv
(concat ",")
(s-replace ", " ",")
(s-replace "," "\n- ")
s-trim
(concat "\n")))
(defun org2jekyll--tags-csv-to-yaml (tags-csv)
"Transform a TAGS-CSV entries into a yaml entries."
(->> tags-csv
(concat ",")
(s-replace ", " ",")
(s-replace "," "\n- ")
s-trim
(concat "\n")))
(defun org2jekyll--compute-ready-jekyll-file-name (date org-file)
"Given a DATE and an ORG-FILE, compute a ready jekyll file name.
If the current path contains the `'org2jekyll-jekyll-drafts-dir`', removes it."
(let ((temp-org-jekyll-filename (format "%s-%s" date (file-name-nondirectory org-file)))
(temp-org-jekyll-directory (file-name-directory org-file)))
(->> temp-org-jekyll-filename
(format "%s%s" temp-org-jekyll-directory)
(replace-regexp-in-string (format "%s" org2jekyll-jekyll-drafts-dir) "")
(replace-regexp-in-string "//" "/"))))
(defun org2jekyll--copy-org-file-to-jekyll-org-file (date org-file yaml-headers)
"Given DATE, ORG-FILE and YAML-HEADERS, copy content as org-jekyll ready file.
This returns the new filename path."
(let ((jekyll-filename (org2jekyll--compute-ready-jekyll-file-name date org-file)))
(with-temp-file jekyll-filename ;; write temporary file updated with jekyll specifics
(insert-file-contents org-file)
(goto-char (point-min))
(insert (org2jekyll--to-yaml-header yaml-headers)))
jekyll-filename))
(defun org2jekyll-assoc-default (key org-data default-value)
"Given KEY, ORG-DATA and DEFAULT-VALUE, return the value associated with key.
Return DEFAULT-VALUE if not found."
(-if-let (data (assoc-default key org-data nil default-value))
data
default-value))
(defvar org2jekyll-header-metadata nil
"The needed headers for org buffer for org2jekyll to work.")
(setq org2jekyll-header-metadata '(("title" . 'mandatory)
("date")
("categories" . 'mandatory)
("tags" . 'mandatory)
("description" . 'mandatory)
("author")
("layout" . 'mandatory)))
(require 'dash-functional)
(defun org2jekyll-check-metadata (org-metadata)
"Check that the mandatory header metadata in ORG-METADATA are provided.
Return the error messages if any or nil if everything is alright."
(let ((mandatory-values (funcall (-compose (lambda (l) (mapcar #'car l))
(lambda (l) (-filter #'cdr l))) org2jekyll-header-metadata)))
(-when-let (error-messages (->> mandatory-values
(--map (when (null (assoc-default it org-metadata))
(format "- The %s is mandatory, please add '#+%s' at the top of your org buffer." it (upcase it))))
(s-join "\n")
s-trim))
(if (string= "" error-messages) nil error-messages))))
(defun org2jekyll-read-metadata (org-file)
"Given an ORG-FILE, return its org metadata.
If non-mandatory values are missing, they are replaced with dummy ones.
Otherwise, display the error messages about the missing mandatory values."
(let* ((org-metadata-list (mapcar #'car org2jekyll-header-metadata))
(org-metadata (org2jekyll-get-options-from-file org-file org-metadata-list)))
(-if-let (error-messages (org2jekyll-check-metadata org-metadata))
(format "This org-mode file is missing mandatory header(s):\n%s\nPublication skipped" error-messages)
`(("layout" . ,(-> "layout" (org2jekyll-assoc-default org-metadata "post")))
("title" . ,(-> "title" (org2jekyll-assoc-default org-metadata "dummy-title-should-be-replaced")))
("date" . ,(-> "date" (org2jekyll-assoc-default org-metadata (org2jekyll-now)) org2jekyll--convert-timestamp-to-yyyy-dd-mm))
("categories" . ,(-> "categories" (org2jekyll-assoc-default org-metadata "dummy-category-should-be-replaced") org2jekyll--categories-csv-to-yaml))
("tags" . ,(-> "tags" (org2jekyll-assoc-default org-metadata "dummy-tags-should-be-replaced") org2jekyll--tags-csv-to-yaml))
("author" . ,(-> "author" (org2jekyll-assoc-default org-metadata "")))
("description" . ,(-> "description" (org2jekyll-assoc-default org-metadata "")))))))
(defun org2jekyll-read-metadata-and-execute (action-fn org-file)
"Execute ACTION-FN function after checking metadata from the ORG-FILE."
(let ((filename-non-dir (file-name-nondirectory org-file)))
(if (org2jekyll-article-p org-file)
(let ((org-metadata (org2jekyll-read-metadata org-file)))
(if (stringp org-metadata)
(org2jekyll-message org-metadata)
(let ((page-or-post (if (org2jekyll-post-p (assoc-default "layout" org-metadata)) "Post" "Page")))
(funcall action-fn org-metadata org-file)
(format "%s '%s' published!" page-or-post filename-non-dir))))
(format "'%s' is not an article, publication skipped!" filename-non-dir))))
(defun org2jekyll-message (&rest args)
"Log formatted ARGS."
(apply 'message (format "org2jekyll - %s" (car args)) (cdr args)))
(defun org2jekyll-publish-post (org-file)
"Publish ORG-FILE as a post."
(org2jekyll-read-metadata-and-execute
(lambda (org-metadata org-file)
(let ((blog-project (assoc-default "layout" org-metadata))
(jekyll-filename (org2jekyll--copy-org-file-to-jekyll-org-file (assoc-default "date" org-metadata) org-file org-metadata)))
(org-publish-file jekyll-filename (assoc blog-project org-publish-project-alist))
(delete-file jekyll-filename)))
org-file))
(defun org2jekyll-publish-page (org-file)
"Publish ORG-FILE as a page."
(org2jekyll-read-metadata-and-execute
(lambda (org-metadata org-file)
(let ((blog-project (assoc-default "layout" org-metadata))
(backup-file (format "%s.org2jekyll" org-file)))
(copy-file org-file backup-file t t t)
(with-temp-file org-file
(insert-file-contents org-file)
(goto-char (point-min))
(insert (org2jekyll--to-yaml-header org-metadata))
(org-publish-file org-file (assoc blog-project org-publish-project-alist)))
(copy-file backup-file org-file t t t)
(delete-file backup-file)))
org-file))
(defun org2jekyll-post-p (layout)
"Determine if the LAYOUT corresponds to a post."
(string= "post" layout))
(defun org2jekyll-page-p (layout)
"Determine if the LAYOUT corresponds to a page."
(string= "default" layout))
(defun org2jekyll-publish-web-project ()
"Publish the 'web' project."
(org2jekyll-message "Publish `'web`' project (images, css, js, etc...).")
(org-publish-project "web"))
;;;###autoload
(defun org2jekyll-publish ()
"Publish the current org file as post or page depending on the chosen layout.
Layout `'post`' is a jekyll post.
Layout `'default`' is a page."
(interactive)
(lexical-let ((org-file (buffer-file-name (current-buffer))))
(deferred:$
(deferred:next (lambda ()
(-> "layout"
org2jekyll-get-option-at-point
org2jekyll-post-p
(if 'org2jekyll-publish-post 'org2jekyll-publish-page))))
(deferred:nextc it (lambda (publish-fn) (funcall publish-fn org-file)))
(deferred:nextc it (lambda (final-message)
(org2jekyll-publish-web-project)
final-message))
(deferred:nextc it (lambda (final-message)
(org2jekyll-message final-message))))))
(defalias 'org2jekyll/publish! 'org2jekyll-publish)
(defvar org2jekyll-mode-map nil "Default Bindings map for org2jekyll minor mode.")
(setq org2jekyll-mode-map
(let ((map (make-sparse-keymap)))
(define-key map (kbd "C-c . n") 'org2jekyll-create-draft)
(define-key map (kbd "C-c . p") 'org2jekyll-publish)
(define-key map (kbd "C-c . P") 'org2jekyll-publish-posts)
(define-key map (kbd "C-c . l") 'org2jekyll-list-posts)
(define-key map (kbd "C-c . d") 'org2jekyll-list-drafts)
map))
;;;###autoload
(defun org2jekyll-publish-posts ()
"Publish all the posts."
(interactive)
(deferred:$
(deferred:next
(lambda () (->> (assoc "post" org-publish-project-alist)
org-publish-get-base-files
(--filter (org2jekyll-post-p (org2jekyll-article-p it))))))
(deferred:nextc it
(lambda (posts)
(mapc #'org2jekyll-publish-post posts)))))
(defalias 'org2jekyll/publish-posts! 'org2jekyll-publish-posts)
;;;###autoload
(defun org2jekyll-publish-pages ()
"Publish all the pages."
(interactive)
(deferred:$
(deferred:next
(lambda () (->> (assoc "default" org-publish-project-alist)
org-publish-get-base-files
(--filter (org2jekyll-page-p (org2jekyll-article-p it))))))
(deferred:nextc it
(lambda (pages)
(mapc #'org2jekyll-publish-page pages)))))
(defalias 'org2jekyll/publish-pages! 'org2jekyll-publish-pages)
;;;###autoload
(define-minor-mode org2jekyll-mode
"Functionality for publishing the current org-mode post to jekyll.
With no argument, the mode is toggled on/off.
Non-nil argument turns mode on.
Nil argument turns mode off.
Commands:
\\{org2jekyll-mode-map}"
:init-value nil
:lighter " o2j"
:group 'org2jekyll
:keymap org2jekyll-mode-map)
(provide 'org2jekyll)
;;; org2jekyll.el ends here
```lisp
Great work!
I installed the newest deferred, version was 20161228.1930, then the org2jekyll would not be started, got an error message:
Symbol's function definition is void: cl-struct-define.
After i changed to deferred-0.3.1, then it is ok now.
Suggest to solve this issue. Or marked the dependency version on your read me.
Thanks.
When publishing a post, it would be great to trigger the image publishing step too.
@sesamemucho Thanks for raising this up.
On emacs startup, during loading my emacs script for config this package, I receive this warning. Seems weird for me, because I did read the source and just found this function, but something strange is happened.
My setup is:
(require 'org)
(require 'org2jekyll)
(custom-set-variables '(org2jekyll-blog-author "Manoel Vilela")
'(org2jekyll-source-directory "D:/Users/Manoel/Dropbox/Programming/Projects/Websiste/Org")
'(org2jekyll-jekyll-directory "d:/Users/Manoel/Dropbox/Programming/Projects/Website/ryukinix.github.io")
'(org2jekyll-jekyll-drafts-dir "")
'(org2jekyll-jekyll-posts-dir "_posts/")
'(org-publish-project-alist
`(("default"
:base-directory ,(org2jekyll-input-directory)
:base-extension "org"
:publishing-directory ,(org2jekyll-output-directory)
:publishing-function org-html-publish-to-html
:headline-levels 4
:section-numbers nil
:with-toc nil
:html-head "<link rel=\"stylesheet\" href=\"./css/style.css\" type=\"text/css\"/>"
:html-preamble t
:recursive t
:make-index t
:html-extension "html"
:body-only t)
("post"
:base-directory ,(org2jekyll-input-directory)
:base-extension "org"
:publishing-directory ,(org2jekyll-output-directory org2jekyll-jekyll-posts-dir)
:publishing-function org-html-publish-to-html
:headline-levels 4
:section-numbers nil
:with-toc nil
:html-head "<link rel=\"stylesheet\" href=\"./css/style.css\" type=\"text/css\"/>"
:html-preamble t
:recursive t
:make-index t
:html-extension "html"
:body-only t)
("images"
:base-directory ,(org2jekyll-input-directory "img")
:base-extension "jpg\\|gif\\|png"
:publishing-directory ,(org2jekyll-output-directory "img")
:publishing-function org-publish-attachment
:recursive t)
("js"
:base-directory ,(org2jekyll-input-directory "js")
:base-extension "js"
:publishing-directory ,(org2jekyll-output-directory "js")
:publishing-function org-publish-attachment
:recursive t)
("css"
:base-directory ,(org2jekyll-input-directory "css")
:base-extension "css\\|el"
:publishing-directory ,(org2jekyll-output-directory "css")
:publishing-function org-publish-attachment
:recursive t)
("web" :components ("images" "js" "css")))))
BTW, great tool.
System info:
Hi,
I have added Marmalade to my emacs and it's working fine (marmalade demo installed and worked just fine) yet I don't have org2jekyll on my package list. Any idea why is that happening?
Thanks,
Hi,
The HTML file that org2jekyll outputs contains the "dummy-tags-should-be-removed" thing, even though I have set tags:nil
.
My full options line is #+OPTIONS: tags:nil toc:nil timestamps:t
. I'm probably just not doing something right. The relevant HTML section:
---
tags:
-
-
-
-
-
-
- dummy-tags-should-be-replaced
---
Thanks!
1, I open the toc:nil
to toc:t
in #+OPTIONS: H:2 num:t tags:nil toc:t timestamps:t
.
2, org2jekyll-publish
3, The result of the file **.html
's head is wrong .
Please help me fix it, thank you
<div id="table-of-contents">
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#sec-1">1. wanna</a></li>
<li><a href="#sec-2">2. but</a></li>
</ul>
</div>
</div>
---
layout: post
title: abdc
date: 2016-04-29
categories:
-
tags:
-
author: yefeiyu
excerpt:
---
<div id="outline-container-sec-1" class="outline-2">
<h2 id="sec-1"><span class="section-number-2">1</span> wanna</h2>
<div class="outline-text-2" id="text-1">
<p>
I want to use `toc:t`<br >
</p>
</div>
</div>
<div id="outline-container-sec-2" class="outline-2">
<h2 id="sec-2"><span class="section-number-2">2</span> but</h2>
<div class="outline-text-2" id="text-2">
<p>
…<br >
</p>
</div>
</div>
I use a "clean theme" https://github.com/scotte/jekyll-clean which allows to add comments, if the post specifies a front matter key/value
comments: true
It is simple to just add
#+COMMENTS: true
on top of every post, but it would be cool if there was a way to customize, or somehow persistently change the list of prompts during org2jekyll-create-draft to include other key/values. I apologize if I missed this is actually possible.
Thanks
Milan
As a user, i can have some old org file hanging that i want to add the header and publish as post.
A routine to do that would be great
When I build a post and published, I run grunt serve
, the result is:
Lunr: Creating search index...
jekyll 3.1.2 | Error: Cannot call method 'toLowerCase' of null
Warning: /home/xx/gh/yefeiyu.github.io/_app/_plugins/jekyll_lunr_js_search.rb:259: warning: already initialized constant Jekyll::LunrJsSearch::VERSION
/usr/local/lib/ruby/gems/2.3.0/gems/jekyll-lunr-js-search-3.1.0/lib/jekyll_lunr_js_search/version.rb:3: warning: previous definition of VERSION was here
Deprecation: posts.each should be changed to posts.docs.each.
Called by /usr/local/lib/ruby/gems/2.3.0/gems/jekyll-last-modified-at-0.3.4/lib/jekyll-last-modified-at/generator.rb:7:in `block in generate'.
My _plugins
's file is jekyll-lunr-js-search.rb
:
require 'fileutils'
require 'net/http'
require 'json'
require 'uri'
require 'v8'
module Jekyll
module LunrJsSearch
class Indexer < Jekyll::Generator
def initialize(config = {})
super(config)
lunr_config = {
'excludes' => [],
'strip_index_html' => false,
'min_length' => 3,
'stopwords' => 'stopwords.txt',
'fields' => {
'title' => 10,
'categories' => 20,
'tags' => 20,
'body' => 1
},
'js_dir' => 'js'
}.merge!(config['lunr_search'] || {})
@js_dir = lunr_config['js_dir']
gem_lunr = File.join(File.dirname(__FILE__), "../../build/lunr.min.js")
@lunr_path = File.exist?(gem_lunr) ? gem_lunr : File.join(@js_dir, File.basename(gem_lunr))
raise "Could not find #{@lunr_path}" if !File.exist?(@lunr_path)
ctx = V8::Context.new
ctx.load(@lunr_path)
ctx['indexer'] = proc do |this|
this.ref('id')
lunr_config['fields'].each_pair do |name, boost|
this.field(name, { 'boost' => boost })
end
end
@index = ctx.eval('lunr(indexer)')
@lunr_version = ctx.eval('lunr.version')
@docs = {}
@excludes = lunr_config['excludes']
# if web host supports index.html as default doc, then optionally exclude it from the url
@strip_index_html = lunr_config['strip_index_html']
# stop word exclusion configuration
@min_length = lunr_config['min_length']
@stopwords_file = lunr_config['stopwords']
end
# Index all pages except pages matching any value in config['lunr_excludes'] or with date['exclude_from_search']
# The main content from each page is extracted and saved to disk as json
def generate(site)
Jekyll.logger.info "Lunr:", 'Creating search index...'
@site = site
# gather pages and posts
items = pages_to_index(site)
content_renderer = PageRenderer.new(site)
index = []
items.each_with_index do |item, i|
entry = SearchEntry.create(item, content_renderer)
entry.strip_index_suffix_from_url! if @strip_index_html
entry.strip_stopwords!(stopwords, @min_length) if File.exists?(@stopwords_file)
doc = {
"id" => i,
"title" => entry.title,
"url" => entry.url,
"date" => entry.date,
"categories" => entry.categories,
"tags" => entry.tags,
"is_post" => entry.is_post,
"body" => entry.body
}
@index.add(doc)
doc.delete("body")
@docs[i] = doc
Jekyll.logger.debug "Lunr:", (entry.title ? "#{entry.title} (#{entry.url})" : entry.url)
end
FileUtils.mkdir_p(File.join(site.dest, @js_dir))
filename = File.join(@js_dir, 'index.json')
total = {
"docs" => @docs,
"index" => @index.to_hash
}
filepath = File.join(site.dest, filename)
File.open(filepath, "w") { |f| f.write(JSON.dump(total)) }
Jekyll.logger.info "Lunr:", "Index ready (lunr.js v#{@lunr_version})"
added_files = [filename]
site_js = File.join(site.dest, @js_dir)
# If we're using the gem, add the lunr and search JS files to the _site
if File.expand_path(site_js) != File.dirname(@lunr_path)
extras = Dir.glob(File.join(File.dirname(@lunr_path), "*.min.js"))
FileUtils.cp(extras, site_js)
extras.map! { |min| File.join(@js_dir, File.basename(min)) }
Jekyll.logger.debug "Lunr:", "Added JavaScript to #{@js_dir}"
added_files.push(*extras)
end
# Keep the written files from being cleaned by Jekyll
added_files.each do |filename|
site.static_files << SearchIndexFile.new(site, site.dest, "/", filename)
end
end
private
# load the stopwords file
def stopwords
@stopwords ||= IO.readlines(@stopwords_file).map { |l| l.strip }
end
def output_ext(doc)
if doc.is_a?(Jekyll::Document)
Jekyll::Renderer.new(@site, doc).output_ext
else
doc.output_ext
end
end
def pages_to_index(site)
items = []
# deep copy pages and documents (all collections, including posts)
site.pages.each {|page| items << page.dup }
site.documents.each {|document| items << document.dup }
# only process files that will be converted to .html and only non excluded files
items.select! {|i| i.respond_to?(:output_ext) && output_ext(i) == '.html' && ! @excludes.any? {|s| (i.url =~ Regexp.new(s)) != nil } }
items.reject! {|i| i.data['exclude_from_search'] }
items
end
end
end
end
require "v8"
require "json"
class V8::Object
def to_json
@context['JSON']['stringify'].call(self)
end
def to_hash
JSON.parse(to_json, :max_nesting => false)
end
end
require 'nokogiri'
module Jekyll
module LunrJsSearch
class PageRenderer
def initialize(site)
@site = site
end
# render item, but without using its layout
def prepare(item)
layout = item.data["layout"]
begin
item.data.delete("layout")
if item.is_a?(Jekyll::Document)
output = Jekyll::Renderer.new(@site, item).run
else
item.render({}, @site.site_payload)
output = item.output
end
ensure
# restore original layout
item.data["layout"] = layout
end
output
end
# render the item, parse the output and get all text inside <p> elements
def render(item)
layoutless = item.dup
Nokogiri::HTML(prepare(layoutless)).text
end
end
end
end
require 'nokogiri'
module Jekyll
module LunrJsSearch
class SearchEntry
def self.create(site, renderer)
if site.is_a?(Jekyll::Page) or site.is_a?(Jekyll::Document)
if defined?(site.date)
date = site.date
else
date = nil
end
categories = site.data['categories']
tags = site.data['tags']
title, url = extract_title_and_url(site)
is_post = site.is_a?(Jekyll::Document)
body = renderer.render(site)
SearchEntry.new(title, url, date, categories, tags, is_post, body, renderer)
else
raise 'Not supported'
end
end
def self.extract_title_and_url(item)
data = item.to_liquid
[ data['title'], data['url'] ]
end
attr_reader :title, :url, :date, :categories, :tags, :is_post, :body, :collection
def initialize(title, url, date, categories, tags, is_post, body, collection)
@title, @url, @date, @categories, @tags, @is_post, @body, @collection = title, url, date, categories, tags, is_post, body, collection
end
def strip_index_suffix_from_url!
@url.gsub!(/index\.html$/, '')
end
# remove anything that is in the stop words list from the text to be indexed
def strip_stopwords!(stopwords, min_length)
@body = @body.split.delete_if() do |x|
t = x.downcase.gsub(/[^a-z]/, '')
t.length < min_length || stopwords.include?(t)
end.join(' ')
end
end
end
end
module Jekyll
module LunrJsSearch
class SearchIndexFile < Jekyll::StaticFile
# Override write as the index.json index file has already been created
def write(dest)
true
end
end
end
end
module Jekyll
module LunrJsSearch
VERSION = "3.1.0"
end
end
Is it easy fix?
I already set up the config through customize-group.
`'(org2jekyll-blog-author "louiszgm" (org2jekyll))
'(org2jekyll-jekyll-directory "~/louiszgm.github.io/" (org2jekyll))
'(org2jekyll-jekyll-drafts-dir "" (org2jekyll))
'(org2jekyll-jekyll-posts-dir "_posts/" (org2jekyll))
'(org2jekyll-source-directory "~/orgResource/" (org2jekyll))`
When i use org2jekyll-publish-posts function , I got the error deferred error: (wrong-type-argument stringp nil)
but it's ok to use org2jekyll-create-draft function.
This is the debug backtrace
Debugger entered--entering a function:
* org2jekyll-publish-posts()
funcall-interactively(org2jekyll-publish-posts)
call-interactively(org2jekyll-publish-posts record nil)
command-execute(org2jekyll-publish-posts record)
#[257 "\304\305!\203\f�\306\307�!!\210��\307�!\211��\310\307�!\311\")\207" [current-prefix-arg prefix-arg this-command real-this-command featurep smex smex-rank intern command-execute record] 4 "\n\n(fn CMD)"]("org2jekyll-publish-posts")
ivy-call()
ivy-read("M-x " ("debug-on-entry" "org-html-export-as-html" "package-install" "org2jekyll-list-posts" "toggle-debug-on-error" "debug" "customize-group" "org2jekyll-create-draft" "org2jekyll-mode" "cua-cut-region" "replace-string" "org-cut-subtree" "org2jekyll-publish" "package-refresh-contents" "kill-ring-save" "clipboard-kill-ring-save" "org2jekyll-init-current-buffer" "cd" "ri" "5x5" "arp" "dbx" "dig" "erc" "ert" "eww" "ftp" "gdb" "irc" "jdb" "man" "mpc" "pdb" "pwd" "rsh" "sdb" "vlf" "xdb" "calc" "dark" "diff" "dirs" "ffap" "gnus" "grep" "help" "ielm" "info" "life" "mail" ...) :predicate nil :require-match t :history counsel-M-x-history :action #[257 "\304\305!\203\f�\306\307�!!\210��\307�!\211��\310\307�!\311\")\207" [current-prefix-arg prefix-arg this-command real-this-command featurep smex smex-rank intern command-execute record] 4 "\n\n(fn CMD)"] :sort nil :keymap (keymap (67108908 . counsel--info-lookup-symbol) (67108910 . counsel-find-symbol)) :initial-input nil :caller counsel-M-x)
counsel-M-x()
funcall-interactively(counsel-M-x)
call-interactively(counsel-M-x nil nil)
command-execute(counsel-M-x)
Build fails on unrelated org2jekyll issues.
It currently fails on the cask install instruction step.
0.52s$ nix-env -iA nixpkgs.cask
339installing 'cask-0.8.4'
340error: unknown hash algorithm '', at /nix/store/fhksmnm8dk9b1hs99sfzha4nwvpfs86n-nixpkgs-20.09pre227892.b27a19d5bf7/nixpkgs/pkgs/build-support/fetchurl/default.nix:119:3
341(use '--show-trace' to show detailed location information)
342The command "nix-env -iA nixpkgs.cask" failed and exited with 1 during .
When i use M-x org2jekyll-publish-posts
, it generated the yaml header like this:
---
date: 2018-03-07
tags:
- CC
author: louiszgm
layout: post
title: CC
excerpt: CC
categories:
- CC
---
I want the layout value to be single
, the expected yaml header i want like this:
date: 2018-03-07
tags:
- CC
author: louiszgm
layout: single
title: CC
excerpt: CC
categories:
- CC
---
Shoud i hook the plugin?
Here you describe that is possible passing extra-headers as normal org tags. But, I'm trying setup my code syntax highlight to get a black background with this:
#+HTML_HEAD: <style>pre.src {background-color: #303030; color: #e5e5e5;}</style>
But, adding that generates an additional (and non-intentional) entry on YAML:
...
html_head: <style>pre.src {background-color: #303030; color: #e5e5e5;}</style>
...
I wanna know if is possible disable this function only in this line, like :noexport:
or something else.
Hello,
Can you please provide the following information?
Thanks in advance.
I would like to use org2jekyll
in conjunction with org-roam
to publish some of my notes. All org-roam
nodes start with a :PROPERTIES:
drawer, which somehow fails the test of org2jekyll-get-options-from-buffer
and returns nil
, breaking the publish function.
Edebug: org2jekyll-get-options-from-buffer
org2jekyll-get-options-from-buffer
Result: #<buffer 2022-12-15-still_face.org>
Result: #<buffer 2022-12-15-still_face.org>
Result: "/home/sati/org/roam/rainshoots/2022-12-15-still_fa..."
Result: #<buffer 2022-12-15-still_face.org>
Result: 1 (#o1, #x1, ?\C-a)
Result: 1 (#o1, #x1, ?\C-a)
Result: "^#\\+\\(.+\\):[ ]+\\(.*\\)$"
Result: (closure (t) nil (edebug-enter 'edebug-anon637 (list) #'(lambda nil (edebug-after (edebug-before 0) 5 (buffer-substring-no-properties (edebug-after (edebug-before 1) 2 (line-beginning-position)) (edebug-after (edebug-before 3) 4 (line-end-position)))))))
Result: 1 (#o1, #x1, ?\C-a)
Result: 13 (#o15, #xd, ?\C-m)
Result: ":PROPERTIES:"
Result: ":PROPERTIES:"
Result: nil
Result: nil
Result: nil
Result: nil
Result: nil
Result: nil
Result: nil
Result: nil
Result: nil
Result: nil
Result: org2jekyll-publish-page
Result: org2jekyll-publish-page
Result: "/home/sati/org/roam/rainshoots/2022-12-15-still_fa..."
Result: 1 (#o1, #x1, ?\C-a)
Result: 1 (#o1, #x1, ?\C-a)
Result: "^#\\+\\(.+\\):[ ]+\\(.*\\)$"
Result: (closure (t) nil (edebug-enter 'edebug-anon637 (list) #'(lambda nil (edebug-after (edebug-before 0) 5 (buffer-substring-no-properties (edebug-after (edebug-before 1) 2 (line-beginning-position)) (edebug-after (edebug-before 3) 4 (line-end-position)))))))
Result: 1 (#o1, #x1, ?\C-a)
Result: 13 (#o15, #xd, ?\C-m)
Result: ":PROPERTIES:"
Result: ":PROPERTIES:"
Result: nil
Result: nil
Result: nil
Result: nil
Result: nil
Result: nil
Result: "'2022-12-15-still_face.org' is not an article, pub..."
org2jekyll - Publish ‘’web‘’ project (images, css, js, etc...) done.
Result: t
Result: "'2022-12-15-still_face.org' is not an article, pub..."
org2jekyll - ’2022-12-15-still_face.org’ is not an article, publication skipped!
Result: "org2jekyll - ’2022-12-15-still_face.org’ is not an..."
Result: "org2jekyll - ’2022-12-15-still_face.org’ is not an..."
Result: "org2jekyll - ’2022-12-15-still_face.org’ is not an..."
Please:
- Describe your problem with clarity and conciceness (cf. https://www.gnu.org/software/emacs/manual/html_node/emacs/Understanding-Bug-Reporting.html)
- Explicit your installation choice (melpa, marmalade, el-get, tarball, git clone...).
- A sample of your configuration.
- Report the following message trace inside your issue.
System information:
- system-type: gnu/linux
- locale-coding-system: utf-8-unix
- emacs-version: GNU Emacs 28.2 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.20, cairo version 1.16.0)
of 2022-11-25
- org version: 9.6
- org2jekyll version: 0.2.7
- org2jekyll path: /home/sati/.emacs.d/.local/straight/build-28.2/org2jekyll/org2jekyll.el
Article is published to jekyll _posts
folder, as expected.
Error:
’2022-12-15-still_face.org’ is not an article, publication skipped!
Publish an article in org-roam
with the relevant file headings.
Tweak the org2jekyll-get-options-from-buffer
function to allow more flexibility.
Users can build their blog using org-roam
.
Thanks for sharing!
Cheers,
Some Jekyll themes allow customizing how the post looks by adding custom YAML headers. Thanks to #40 it is now possible to add custom key-value options to the front matter. However, it is sometimes necessary to add YAML code which is not just a key-value. This is what I'm trying to add currently:
header:
teaser: /assets/images/my-awesome-post-teaser.jpg
Is there any way to achieve that without patching org2jekyll?
in the generated html, the format of the DATE is like this
date: 2016-11-21
but date: 2016-11-21 21:20:48
would be better
When publishing a page, the yaml output is missing.
It's a definitely a bug.
Hi,
Things worked well for months, but, now, I got this error when trying to publish, in whatever layout, or even when trying to modify an already published article.
deferred error : (error "File ~/Documents/org/jekyll/xxx.org not part of any known project")
Jekyll server seems ok, for modifying and publishing html files directly is ok.
I don't really know where to start to solve this...
I think so.
Right now this won't run for me.
But I'm on emacs 27.2. macOS 11.5. I'm using use-package and straight.el for package management.
None II was initialising the package.
What really happened?
In my Warnings buffer I get:
Error (use-package): org2jekyll/:catch: Recursive load: "/Users/robertpostill/.emacs.d/straight/build/org2jekyll/org2jekyll.elc", "/Applications/Emacs.app/Contents/Resources/lisp/org/ox-publish.elc", "/Users/robertpostill/.emacs.d/straight/build/org2jekyll/org2jekyll.elc", "/Applications/Emacs.app/Contents/Resources/lisp/org/ox-publish.elc", "/Users/robertpostill/.emacs.d/straight/build/org2jekyll/org2jekyll.elc", "/Applications/Emacs.app/Contents/Resources/lisp/org/ox-publish.elc", "/Users/robertpostill/.emacs.d/straight/build/org2jekyll/org2jekyll.elc", "/Applications/Emacs.app/Contents/Resources/lisp/org/ox-publish.elc", "/Users/robertpostill/.emacs.d/straight/build/org2jekyll/org2jekyll.elc", "/Users/robertpostill/.emacs.d/init.el"
Initialise the package.
My config:
(use-package org2jekyll
:straight t
:after org
:hook
(('org-mode-hook . 'turn-on-flyspell)
('org-mode-hook . #'org2jekyll-mode))
:custom
(org2jekyll-blog-author "robertpostill")
(org2jekyll-source-directory (expand-file-name "~/software/robertpostill.github.io/org/"))
(org2jekyll-jekyll-directory (expand-file-name "~/software/robertpostill.github.io/"))
(org2jekyll-jekyll-drafts-dir "")
(org2jekyll-jekyll-posts-dir "_posts/")
(org-publish-project-alist
`(("default"
:base-directory ,(org2jekyll-input-directory)
:base-extension "org"
:publishing-directory ,(org2jekyll-output-directory)
:publishing-function org-html-publish-to-html
:headline-levels 4
:section-numbers nil
:with-toc nil
:html-head "<link rel=\"stylesheet\" href=\"./css/style.css\" type=\"text/css\"/>"
:html-preamble t
:recursive t
:make-index t
:html-extension "html"
:body-only t)
("post"
:base-directory ,(org2jekyll-input-directory)
:base-extension "org"
:publishing-directory ,(org2jekyll-output-directory org2jekyll-jekyll-posts-dir)
:publishing-function org-html-publish-to-html
:headline-levels 4
:section-numbers nil
:with-toc nil
:html-head "<link rel=\"stylesheet\" href=\"./css/style.css\" type=\"text/css\"/>"
:html-preamble t
:recursive t
:make-index t
:html-extension "html"
:body-only t)
("images"
:base-directory ,(org2jekyll-input-directory "img")
:base-extension "jpg\\|gif\\|png"
:publishing-directory ,(org2jekyll-output-directory "img")
:publishing-function org-publish-attachment
:recursive t)
("js"
:base-directory ,(org2jekyll-input-directory "js")
:base-extension "js"
:publishing-directory ,(org2jekyll-output-directory "js")
:publishing-function org-publish-attachment
:recursive t)
("css"
:base-directory ,(org2jekyll-input-directory "css")
:base-extension "css\\|el"
:publishing-directory ,(org2jekyll-output-directory "css")
:publishing-function org-publish-attachment
:recursive t)
("web" :components ("images" "js" "css")))))
There exist at least 69 packages that contain a file named test-helper.el
that also provides the feature test-helper
.
This leads to issues for users who have at least two of these packages installed. It is unlikely that such a user would be able to run the tests of all of those packages. If the primary test file of one of those packages does (require 'test-helper)
, then it is undefined which of the various test-helper.el
files gets loaded. Which it is, depends on the order of the load-path
.
To avoid this conflicts, you should rename your test-helper.el
to <your-package>-test-helper.el
and adjust the feature and symbol prefixes accordingly.
Also don't forget to update the require
form in your primary test file and/or update references to the library/feature elsewhere. Also, if your primary test file is named something like test.el
, then please consider renaming that too (same for any other utility elisp files your repositoroy may contain).
Thanks!
PS: This issue is a bit generic because I had to open 69 issues.
Linking to another page/post from the blog currently exports a file://
path.
Sample:
[[/permalink-to-another-blog-post]]
renders:
file:///permalink-to-another-blog-post
This is not what the users expect, they want a link to another post/page from
their own blog. Definitely a link which is browsable both locally (testing) and
remotely (without having to mention the full server url).
Indeed, manually removing file://
from the published post expectedly renders
a browsable link both locally and remotely.
The issue is within org-mode. If we don't write something sensible, link wise,
org-mode will, by default, refuse to export due to broken links. If we
deactivate the custom about broken link, the link disappears altogether when
the post is published/exported...
So that's not good.
Digging a bit further, aside modifying code, i think we cannot circumvent
this... But, we might be able to extend org-mode's hyperlink policy [1]
So I imagine something like adding a local
or raw
prefix to the link would
do. For example, the link could become (if I understood the doc right):
[[local:/permalink-to-another-blog-post]]
[1] https://orgmode.org/manual/Adding-Hyperlink-Types.html#Adding-Hyperlink-Types
@robertposthill might be interested as I started digging this when seeing his
question on stackexchange [2]. I started replying, but thought, first let's
check... Then, as it did not work ¯_(ツ)_/¯, started investigating [2]
[2] https://emacs.stackexchange.com/questions/58628/org2jekyll-and-links
How easy is to implement DISQUS commenting with jekyll? Thanks.
Hello,
Can you please provide the following information?
Thanks in advance.
This is not exactly a bug, more like a feature request.
System information:
- system-type: gnu/linux
- locale-coding-system: utf-8-unix
- emacs-version: GNU Emacs 28.2 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.20, cairo version 1.16.0)
of 2022-12-09
- org version: 9.6
- org2jekyll version: 0.2.7
- org2jekyll path: /home/sati/.emacs.d/.local/straight/build-28.2/org2jekyll/org2jekyll.el
I would like to publish some of my org-roam
nodes with org2jekyll
, but it seems that the internal links that take the form [[id:some-alphanumeric-id][/description/]]
do not work out of the box.
Setting org-publish
:publishing-function
to org-html-publish-to-html
, the above link resolves to <a href="filename.html#ID-some-alphanumeric-id">
, which doesn't work.
What works is: <a href="../filename">
.
Publish a node in org-roam
with org2jekyll-publish
.
How can we try and reproduce?
Please your org2jekyll configuration.
And the Compile-Log buffer when it's some suspected packaging problem...
The publishing of org-roam nodes should be supported.
A function like org2jekyll-local-link-export
that resolves org-roam
links properly.
Zettels can be published in a blog!
Thanks for sharing!
Cheers,
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.