Skip to content
TheChatArchiveThe Chat Archive
DeepSeekdeepseek-v3-0324· DeepSeekHugging Face LMArena Human Preference 140K

I just switched my whole workflow to Emacs. I run a personal blog and I want to run it…

From a Chatbot Arena battleThe same person sent this prompt to two anonymous models at once. Compare it with DeepSeekdeepseek-r1-0528’s answer.
  1. User

    I just switched my whole workflow to Emacs. I run a personal blog and I want to run it through Orgmode for generation. How should I do it?

  2. DeepSeek Assistant

    Congratulations on switching to Emacs! Using Org mode for your personal blog is a great choice—it allows you to write in a structured, distraction-free environment while leveraging Emacs' powerful publishing capabilities. Here’s a step-by-step guide to setting up a blog with Org mode:


    1. Basic Setup

    First, ensure you have the latest Emacs and Org mode installed. You can install Org mode via M-x package-install RET org RET if it's not already included.


    2. Organize Your Blog Structure

    Create a directory for your blog with the following structure:

    ~/my-blog/
    ├── content/       # Org files for posts/pages
    ├── static/        # Images, CSS, JS
    ├── public/        # Generated HTML (output)
    └── publish.el     # Publishing configuration
    

    3. Configure Publishing (publish.el)

    Add this to your publish.el (or init.el/config.el):

    (require 'ox-publish)
    
    (setq org-publish-project-alist
          '(("blog-content"
             :base-directory "~/my-blog/content/"
             :base-extension "org"
             :publishing-directory "~/my-blog/public/"
             :recursive t
             :publishing-function org-html-publish-to-html
             :headline-levels 4
             :auto-preamble t
             :auto-sitemap t                ; Generate index page
             :sitemap-title "Blog Archive"
             :sitemap-filename "index.org"  ; Outputs to index.html
             :sitemap-sort-files anti-chronologically
             :html-head "<link rel='stylesheet' href='/css/style.css' />"
             :html-preamble "<div class='header'><h1>My Blog</h1></div>"
             :html-postamble "<div class='footer'><p>Made with Emacs + Org</p></div>")
            
            ("blog-static"
             :base-directory "~/my-blog/static/"
             :base-extension "css\\|js\\|png\\|jpg\\|gif\\|pdf\\|mp3\\|ogg\\|svg"
             :publishing-directory "~/my-blog/public/"
             :recursive t
             :publishing-function org-publish-attachment)
            
            ("blog" :components ("blog-content" "blog-static"))))
    

    Key Options:

    • auto-sitemap: Generates an index page listing all posts.
    • html-head: Add custom CSS/JS.
    • html-preamble/postamble: Add headers/footers.

    4. Write Posts in Org Mode

    Create .org files in ~/my-blog/content/. Example:

    #+TITLE: My First Post
    #+DATE: 2024-05-20
    #+TAGS: emacs, blogging
    
    * Introduction
    This is my first post published from Org mode!
    

    Frontmatter Options:

    • #+TITLE, #+DATE, #+TAGS are used for metadata.
    • Use #+OPTIONS: toc:2 to add a table of contents.

    5. Publish Your Blog

    Run M-x org-publish and select the blog project. Alternatively, add this to publish.el:

    (defun publish-blog ()
      (interactive)
      (org-publish "blog" t))
    

    Now you can run M-x publish-blog to regenerate all files.


    6. Automate Publishing

    To auto-publish on save, add this to publish.el:

    (defun auto-publish-on-save ()
      (when (string= (buffer-file-name) "~/my-blog/content/YOUR_POST.org") ; Adjust path
        (publish-blog)))
    (add-hook 'after-save-hook 'auto-publish-on-save)
    

    7. Style Your Blog

    • Add a CSS file in ~/my-blog/static/css/style.css and link it in :html-head.
    • Use #+HTML_HEAD: <link...> in individual posts for custom styling.

    8. Advanced Options

    • Themes: Use packages like org-html-themes or ox-hugo (for Hugo compatibility).
    • Comments: Add Disqus via :html-postamble.
    • RSS Feed: Use ox-rss to generate a feed.

    9. Deploy

    Sync the ~/my-blog/public/ folder to your web server (e.g., via GitHub Pages, Netlify, or rsync).


    Example Workflow

    1. Write a post in content/post.org.
    2. Run M-x publish-blog.
    3. Preview locally with python3 -m http.server in ~/my-blog/public/.
    4. Deploy to your host.

    Alternatives

    • For more complex needs, consider:
      • ox-hugo: Export to Hugo-compatible Markdown.
      • org-static-blog: A dedicated package for blogs.

    This setup keeps everything in Emacs while giving you full control over the output. Happy blogging!

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.