• Home
  • Categories
  • Recent
  • Popular
  • Top
  • Tags
  • Users
  • Groups
  • Documentation
    • Home
    • Read API
    • Write API
    • Plugin Development
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
v3.5.2 Latest
Buy Hosting

print category name inside topic page

Scheduled Pinned Locked Moved General Discussion
3 Posts 2 Posters 1.2k Views
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    asma_90
    wrote on last edited by
    #1

    Is there a way to render the category of a post in a topic page ? something like this work inside recent page :
    <a href="{config.relative_path}/category/{topics.category.slug}"> {topics.category.name}</a>
    is there anything similiar where I can add inside post.tpl ?
    am trying to avoide using js for this.

    1 Reply Last reply
    0
  • barisB Offline
    barisB Offline
    <baris> NodeBB
    wrote on last edited by baris
    #2

    Yes, inside post.tpl (which is just a partial that is included into topic.tpl) you can use all the variables from /api/topic/1 endpoint.

    So it would look like

    <a href="{config.relative_path}/category/{category.slug}"> {category.name}</a>

    Hope that helps.

    A 1 Reply Last reply
    1
  • A Offline
    A Offline
    asma_90
    replied to <baris> on last edited by
    #3

    @baris it works! thanks a lot!

    1 Reply Last reply
    0

Copyright © 2023 NodeBB | Contributors
  • Login

  • Don't have an account? Register

  • Login or register to search.
Powered by NodeBB Contributors
  • First post
    Last post
0
  • Home
  • Categories
  • Recent
  • Popular
  • Top
  • Tags
  • Users
  • Groups
  • Documentation
    • Home
    • Read API
    • Write API
    • Plugin Development