Skip to content
Advertisement

How to list the titles of html pages with links on the home page in Django

Picture of my window

I am sorry if this is a stupid question but I am new to Django. I am building a website and I have articles saved as template files. I want to display all of their titles with links directed to those templates but I want to automatically list them so if I add a new template to the folder, the home page will have the new link to that template. Is there a way to do that?

So as I show in the picture… I have a folder for article sites, but I want to list their titles and the URLs on the home page. I know we can do it manually but I want to automatically list them, so every time we add one or remove an article, the home page list should get modified automatically.

Thank you for your help.

Advertisement

Answer

I don’t know if there is an efficient way of doing what you want to do. But i think if your article has same features and if it is showing in the same html structure i prefer using database for storing each article and use only one template for rendering those details.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement