• 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

Show static images in custom theme

Scheduled Pinned Locked Moved Solved Technical Support
4 Posts 2 Posters 405 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.
  • Daniel KückD Offline
    Daniel KückD Offline
    Daniel Kück
    wrote on last edited by Daniel Kück
    #1

    Hey mates,

    I'm trying to show a static image in my custom theme.
    The custom theme works fine but the images don't get displayed.

    The folder structure looks like this:
    theme-root
    --static
    ----images
    ------image.png
    --templates
    ----folder
    ------file.tpl

    And the line of code where I try to implement looks like this:
    <img src="/theme-root/static/images/image.png">

    I tried several things but nothing worked for me.

    PitaJP 1 Reply Last reply
    0
  • PitaJP Offline
    PitaJP Offline
    PitaJ Global Moderator Plugin & Theme Dev
    replied to Daniel Kück on last edited by PitaJ
    #2

    @daniel-kück what does the plugin.json in your theme look like? You'll probably need to add a staticDirs like this:

      "staticDirs": {
        "images": "static/images"
      },
    

    And then access the image like this:

    <img src="{config.relative_path}/plugins/nodebb-theme-yourtheme/images/image.png">
    

    https://github.com/NodeBB/nodebb-plugin-emoji/blob/master/plugin.json#L13
    https://github.com/NodeBB/nodebb-plugin-emoji/blob/master/public/lib/emoji.ts#L4

    Daniel KückD 1 Reply Last reply
    2
  • Daniel KückD Offline
    Daniel KückD Offline
    Daniel Kück
    wrote on last edited by
    #3

    Nice it worked, thanks a lot!

    1 Reply Last reply
    0
  • Daniel KückD Offline
    Daniel KückD Offline
    Daniel Kück
    replied to PitaJ on last edited by
    #4

    @pitaj sorry i cant resolve this topic

    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