Skip to content
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

Still can't get a simple example to work #63

Open
sangwon-hyun opened this issue Apr 10, 2022 · 3 comments
Open

Still can't get a simple example to work #63

sangwon-hyun opened this issue Apr 10, 2022 · 3 comments

Comments

@sangwon-hyun
Copy link

Hi,

I'm someone who really, really likes the idea of weblorg and who doesn't really know that much Lisp.

I just can't get even a simple example to work. I have simplified my publish.el file as much as possible, so that it's just one main.org file (and perhaps one css file).

I have a simple request! There still isn't a super simple example that you could just run emacs --script publish.el on, and see a website to come out of it. I'm sure once I see something like this, I'll be able to figure out incrementally how to customize, but I haven't even gotten one example to work.

(For the sake of completeness, here is the publish.el I'm using.)

(add-to-list 'load-path "~/emacs")

;; Setup package management
(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
(package-initialize)
(unless (package-installed-p 'use-package)
  (package-refresh-contents)
  (package-install 'use-package))

;; Install and configure dependencies
(use-package templatel :ensure t)
(use-package htmlize
  :ensure t
  :config
  (setq org-html-htmlize-output-type 'css))

(require 'weblorg)

(weblorg-site
 :template-vars '(("site_author" . "Justin")
		  ("site_name" . "Justin's website")
		  ("project_description" . "Justin")))

;; Set theme
(weblorg-site
 :theme #'weblorg-theme-autodoc)



;; Route for rendering each post
(weblorg-route
 :input-pattern "*.org"
 :template "post.html"
 :output "output/posts/{{ slug }}.html"
 :url "/{{ slug }}.html")


;; fire the engine and export all the files declared in the routes above
(weblorg-export)
@dr-neptune
Copy link

Hi @sangwon-hyun,

I was able to get a working example by doing the following:

  1. clone the repository
  2. under the examples directory in the repository, copy the simpleblog example into its own directory examples/simpleblog/
  3. run emacs --script publish.el in your new simpleblog directory. This will generate all the posts in the posts/ folder
  4. install the httpd-server emacs package
  5. customize the variable httpd-port to use port 8000
  6. M-x httpd-serve-directory and serve the folder output/

Now you should be able to browse the resulting web page at localhost:8000. From here you can edit the posts, themes, etc to your liking

@lakkiy
Copy link

lakkiy commented Jun 24, 2022

I didn't see any themes, and link to about or post not work too.

@danielnemenyi
Copy link

danielnemenyi commented Aug 21, 2023

@404CN There's what looks like a mistake in the documentation, which my pull request above suggests a resolution to. The documentation states that the :output of weblorg-copy-static should be :output "static/{{ file }}", but that's outside of the output directory and so the stylesheets wouldn't be being served. Setting it to :output "output/static/{{ file }}" should fix the situation. Ie:

(weblorg-copy-static
 :output "output/static/{{ file }}"
 :url "/static/{{ file }}")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants