Replies: 4 comments 6 replies
-
|
@pranabdas, any trick that could solve this too? I think it is the last major hiccup on my migration path. |
Beta Was this translation helpful? Give feedback.
-
|
It's unclear to me if you want to do something at build time or runtime because both are mentioned. Also unclear to me what should be the outcome of this filtering. Giving us the URL of your existing site as an example would help to understand. You give us some liquid template (which we don't particularly know) and let us try to infer what the behavior should be without additional context, that's a bit rough 😅 Please give us all the details, show us the live site URL, explain to us what this liquid code does, what's the behavior you want on each Docusaurus page etc... Be exhaustive and help us help you. |
Beta Was this translation helpful? Give feedback.
-
|
Sorry if my question was confusing :-(
At build time, as mentioned in the subject.
In my particular case, a page with links to all release blog posts. The blog posts may also include other announcements, which I might want listed in a different page.
Sure. Here is such a page: The page was generated by the following code:
My bad. I assumed that the liquid template syntax is self-explanatory. :-( After indenting, the code looks like this: {% for post in site.posts %}
{% if post.categories contains "releases" %}
{% if post.categories contains "arm-none-eabi-gcc" %}
* [{{ post.title }}]({{ site.baseurl }}{{ post.url }}) [(download)]({{ post.download_url }})
{% endif %}
{% endif %}
{% endfor %}The point is that Jekyll parses the markdown pages and builds several lists, for pages, for blog posts, tags, categories, etc. The code iterates over the site posts and keeps only those with a category of release and arm-none-eabi-gcc (which is the current sub-web, since the web includes 19 sub-webs, for multiple tools). I guess Docusaurus similarly parses the files below the
@slorber, if the above explanations are not enough, and you need more details, please let me know. Thank you in advance for your help. |
Beta Was this translation helpful? Give feedback.
-
|
Hello Sébastien @slorber, Now that 3.0 is out (which is great news!), I would like to resume work on this issue, and find a solution to iterate over the blog posts at build time. I already have a functional draft site, with some posts: Some of the posts have additional front matter properties, in fact some dates to be used for a chronology of events, for example: I would like to display, in the home page, an ordered table with links to the posts that have the For this I would need to iterate over the list of posts, check the front matter for this property, and generate the table component (each event is shown on a raw, with a date and a link to the actual post). The concrete question is: Does the new version of the blog plugin provide a way to get the list of posts? If not, what alternate solutions do you recommend? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I checked the plugin-content-blog documentation, but it seems focused more on configuration than on run-time functionality.
Is it possible, at build time, to iterate over the list of blog posts, and filter a selection based on categories?
I have the following code from Jekyll, in markdown with Liquid engine tags, which I would like to translate to Docusaurus/React:
Beta Was this translation helpful? Give feedback.
All reactions