Bhupesh-V / tutorialdb

A search 🔎 engine for programming/dev tutorials,
MIT License
122 stars 60 forks source link

Dynamic title #6

Closed Bhupesh-V closed 5 years ago

Bhupesh-V commented 5 years ago

Currently the title of diifferent pages remains the same - tutorialdb. It would be nice if the title changes dynamically too for e.g tutorialdb - API, tutorialdb - Latest

Animesh-Ghosh commented 5 years ago

We can add an {%if title%}{{ title }}{%endif%} tag in base.html and pass the title that we want to the context that will be rendered.

Animesh-Ghosh commented 5 years ago

For function-based views, we can just pass the title in the context.

For class-based views, we can override the generic view's get_context_data and add the title to the context.