@@ -103,6 +103,11 @@ if emacs --batch \
103103 \" <nav class=\\\" site-nav\\\" >\"
104104 \" <a href=\\\" /\\\" >Home</a>\"
105105 \" <a href=\\\" /about.html\\\" >About</a>\"
106+ \" <div class=\\\" lang-switcher\\\" >\"
107+ \" <button class=\\\" lang-btn active\\\" data-lang=\\\" en\\\" >EN</button>\"
108+ \" <span class=\\\" lang-divider\\\" >|</span>\"
109+ \" <button class=\\\" lang-btn\\\" data-lang=\\\" cn\\\" >中文</button>\"
110+ \" </div>\"
106111 \" </nav>\"
107112 \" </div>\"
108113 \" </header>\" ))
@@ -117,9 +122,23 @@ if emacs --batch \
117122 \" </div>\"
118123 \" </footer>\" ))
119124
120- ;; Custom sitemap function to exclude author
125+ ;; Function to check if a file is a draft
126+ (defun blog/is-draft-p (file)
127+ \" Check if FILE has #+DRAFT: true property.\"
128+ (with-temp-buffer
129+ (insert-file-contents file)
130+ (goto-char (point-min))
131+ (re-search-forward \" ^#\\\\ +DRAFT:\\\\ s-*\\\\ (true\\\\ |t\\\\ |yes\\\\ )\" nil t)))
132+
133+ ;; Custom publishing function that skips drafts
134+ (defun blog/publish-to-html (plist filename pub-dir)
135+ \" Publish an org file to HTML, but skip if it's a draft.\"
136+ (unless (blog/is-draft-p filename)
137+ (org-html-publish-to-html plist filename pub-dir)))
138+
139+ ;; Custom sitemap function to exclude author and draft posts
121140 (defun blog/sitemap-function (title list)
122- \" Generate sitemap as an Org file without author metadata.\"
141+ \" Generate sitemap as an Org file without author metadata and draft posts .\"
123142 (concat \" #+TITLE: Noob Notes\\ n\"
124143 \" #+AUTHOR:\\ n\"
125144 \" #+OPTIONS: author:nil toc:nil num:nil h:0\\ n\\ n\"
@@ -132,7 +151,7 @@ if emacs --batch \
132151 :base-extension \" org\"
133152 :publishing-directory ,blog-publish-directory
134153 :recursive t
135- :publishing-function org-html- publish-to-html
154+ :publishing-function blog/ publish-to-html
136155 :headline-levels 4
137156 :section-numbers nil
138157 :with-toc t
@@ -158,14 +177,14 @@ if emacs --batch \
158177 entry
159178 (org-publish-find-title entry project)))
160179 :sitemap-function blog/sitemap-function
161- :exclude \" 404\\\\ .org\\\\ |about\\\\ .org\" )
180+ :exclude \" 404\\\\ .org\\\\ |about\\\\ .org\\\\ |-cn \\\\ .org \ " )
162181
163182 (\" blog-pages\"
164183 :base-directory ,blog-posts-directory
165184 :base-extension \" org\"
166185 :publishing-directory ,blog-publish-directory
167186 :recursive nil
168- :publishing-function org-html- publish-to-html
187+ :publishing-function blog/ publish-to-html
169188 :headline-levels 4
170189 :section-numbers nil
171190 :with-toc t
0 commit comments