Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 243 Vote(s) - 3.51 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How do I display a specific post in Jekyll?

#1
I'm wanting to use `Jekyll` as a CMS essentially, so I would like to take the content from a post and display it in a specific area of my website.

{% for post in site.posts %}
{{ post.content }}
{% endfor %}

This displays all of the content from all of the posts, however I'd like to take content from one post at a time. I'm fairly new to Jekyll, so I'm not sure if i'm supposed to add `YAML` front matter into my posts and target them with a "for post in site with `title_____"` post.content" of sorts.

Thank you!!
Reply

#2
**I figured it out, sorry I posted prematurely.**

The answer is add a category to your post with YAML front matter and then in your include file use:

{% for post in site.categories.CATEGORYNAMEHERE %}
{{ post.content }}
{% endfor %}
Reply

#3

<!-- begin snippet: js hide: false console: true babel: false -->

<!-- language: lang-html -->

{% assign thepost = site.posts | where:"slug","post_slug" %}
{% for post in thepost %}
{{ post.content }}
{% endfor %}

<!-- end snippet -->

And on the post;

`slug: post_slug`
Reply

#4
Starting from Jekyll 4.1.0, you can use [`find`](

[To see links please register here]

):

{{ site.posts | find: "title", "The Post Title" }}
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through