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

Blog style card for latest blog post highlighted on a different page (e.g. the main index.md for the site) #685

Open
kcowgill opened this issue Feb 14, 2024 · 0 comments

Comments

@kcowgill
Copy link

I spent some time trying to dig into what was available via templating to see if I could come up with a way to duplicate what the /blog endpoint does - produce a title/summary card for files in the /blog directory - but if I could grab the information/card for only the latest one to put into my main index.md (so it would be updated automatically on site regeneration)... something like this:

# Main page

Welcome to our page!

:::latest_blog
:icon-megaphone: <strong>{{ blog_title }}</strong> <i>{{ blog_date }}</i>: {{ blog_excerpt }}
:::

More main page content, etc

I even resorted to some ugly bash-fu to do that but ran into styling issues because I'm terrible with CSS. I'm able to update the frontmatter to include this data: chunk:

---
icon: home
label: Site Overview
templating: true
data:
   blog_title: Exercitation Ullamco
   blog_file: blog/lorem.md
   blog_date: 2024-03-01
   blog_excerpt: Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud ...
 ---

But then in thinking about it - the blog layout must have SOME way of generating /blog/index.html to contain those summary cards, is there some other way to get at that information?

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

1 participant