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

Show only post titles in multipost pages (no preview, no contents) #124

Open
protesilaos opened this issue Dec 10, 2023 · 4 comments
Open

Comments

@protesilaos
Copy link

Hello @bastibe and thank you for this package!

I have noticed that when setting org-static-blog-use-preview to nil, the produced archive page includes the complete file contents. The code for that is in org-static-blog-assemble-multipost-page:

    (apply 'concat (mapcar
                    (if org-static-blog-use-preview
                        'org-static-blog-get-preview
                      'org-static-blog-get-post-content)
                    post-filenames))

Do you think we can make this behaviour configurable? The idea is to only display titles without any further contents.

@bastibe
Copy link
Owner

bastibe commented Dec 10, 2023

Hi @protesilaos,

are you sure about the archive? The index should include full posts or previews, but the archive should only include headlines.

@protesilaos
Copy link
Author

protesilaos commented Dec 10, 2023 via email

@bastibe
Copy link
Owner

bastibe commented Dec 12, 2023

I see. If you'd like to contribute a mechanism for a headline-only index, I'd be happy to review it.

@lemyx
Copy link

lemyx commented Dec 13, 2023

I have met the similar situation, my workaround is to cover the configuration outside the pulled repository.

(defun org-static-blog-get-preview (post-filename)
  "Get title, date, tags from POST-FILENAME and get the first paragraph from the rendered HTML.
If the HTML body contains multiple paragraphs, include only the first paragraph,
and display an ellipsis.
Preamble and Postamble are excluded, too."
  (with-temp-buffer
    (insert-file-contents (org-static-blog-matching-publish-filename post-filename))
    (let ((post-title (org-static-blog-get-title post-filename))
          (post-date (org-static-blog-get-date post-filename))
          (preview-region (org-static-blog--preview-region)))
      ;; Put the substrings together.
      (let ((title-link
             (format "<h2 class=\"post-title\"><a href=\"%s\">%s</a></h2>"
                     (org-static-blog-get-post-url post-filename) post-title))
            (date-link
             (format-time-string (concat "<div class=\"post-date\">"
                                         (org-static-blog-gettext 'date-format)
                                         "</div>")
                                 post-date)))
        (concat
         title-link
         preview-region
         date-link
         )))))

By doing so, only title, preview and date are displayed.

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

3 participants