Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

General

Trying to work out what is possible

first-time

Started by Richard Hoare 8 years ago · 2 replies · 714 views
8 years ago

Hi
I like to look of Grav and how it functions. I have just got it functioning on a server.
Before I dive in there too deep is it possible to structure a site a bit like they do on the thoughtco site, where under each article there are short into links to other articles in the same category.
Thanks
Richard

8 years ago

Hi Richard

I am new to Grav too, and am yet to get into the nitty gritty too - I am realising that there is a steep learning curve.

However, to answer your question: Yes, I am fairly sure that what you want is possible.

I imagine the easy way to do it is in the twig template for your article/post pages.

At the end after the article content, use a for loop in twig to capture articles in the same category (and even sub-categories) taxonomy articles, then perhaps sort them by publish date (if that is what you wanted - you may want something else for example 'random' or 'alphabetical title'), and then display their desired information.

Another more granular but manual/harder way would be to create a header array where you manually identify the articles you want displayed for that article.

The Grav documentation even has an example (they call it a 'recipe') for the sort of thing you might want - this lists the latest five posts: https://learn.getgrav.org/cookbook/twig-recipes#list-the-last-5-recent-blog-posts

Hope this helps.

Tim

8 years ago

Hi Tim

That is very useful. You are right the learning curve is steeper than I thought, and I am pretty used to web programming. I often find with these things that they cover all the points without covering the basics. "the idiots guide to creating your template" That is what I need!

I will have a play with your instructions, thanks for taking the time

Cheers
Richard

Suggested topics

Topic Participants Replies Views Activity
General · by Jerry Hunt, 4 days ago
2 80 9 hours ago
General · by pamtbaau, 14 hours ago
1 51 13 hours ago
General · by Andy Miller, 1 day ago
0 44 1 day ago
General · by Marcel, 12 months ago
6 346 5 days ago
General · by Duc , 5 days ago
3 40 5 days ago