Hugo With PHP

Hi ,

I am going to create a blog website using Hugo with some dynamic pages written in PHP. In those dynamic pages, I want to show the latest blog post for a particular category developed in Hugo. I am not able to figure it out how can I do it.

Please help. I am doing POC before working on the actual project.

Thanks
Rajan

2 Likes

Sorry ju52, I am not able to understand your solution.
What I feel that we can solve this problem by creating a JSON file of the latest blog post and read it from PHP. DO you think it will work?

ju52 is likely referring to the answer he gave on the cited question.

Hugo can definitely generate a json file with any selection of content you want. Many use it to create search indexes and json feeds etc. Search this forum and you find many examples.

A json file can easily be read by any number of languages including php but that part is outside of this forum.

1 Like

Yes, you could create sectional rss or json files, then pull those with your PHP files, if you prefer. You can put any file you need, in /static in your project. That translates to the root of the site, when you publish.

But, what @ju52 mentions on that other post is a good solution and you could adapt it to show the latest post for a given category. You don’t need PHP for it, either.

1 Like