If a partial is in the same folder as another .eex file, you can just run render "filename.html", but what if it's in a subfolder? In my case, I have a bunch of partials containing the HTML for some SVG icons. I don't want those files cluttering up the main template directory for my controller (I'd rather have them in templates/pages/icons than templates/pages). If they're not in the same directory as the .eex file that's rendering them, though, referring to them by name doesn't work, nor do things like render "icons/filename.html". What's the proper way to handle this?
Render partial located in child directory in Phoenix
1.3k Views Asked by neurodynamic At
1
There are 1 best solutions below
Related Questions in TEMPLATES
- C++ template using pointer and non pointer arguments in a QVector
- Django urls.py not rendering correct template
- SilverStripe - Multilingual Custom Form Template
- How do I change code template triggering behavior in Netbeans 8.0?
- C++ Templates with multiple constraints
- Access into a Binary Search Tree via a bound function in a function template
- Passing values from an array to child template in meteor
- Convert all html templates to single object and store it in a js file
- C++ static compilation of function with a variable number or arguments
- Boost/C++ eval_if fails
- Xpath rule template is missing in SonarQube 5.1
- Composite Server Templates tabs
- Variadic template method and std::function - compilation error
- C++ Custom std::map<> key class causing memory violation
- explicit instantiation of a function template having integers as template parameters
Related Questions in ELIXIR
- Multiline comment in Elixir
- Output tabular data with IO.ANSI
- Does Elixir have coding standards or an authoritative style guide published by the language developers, like PEP8 or the Erlang Programming Rules?
- Check if a URL is valid in elixir
- Elixir exrm release crashes on eredis start_link
- Writing a library that works for BitStrings or Lists
- Elixir exrm console works but application does not start automatically
- Why do I receive a FunctionClauseError ("no function clause matching") in this Elixir program, translated from Erlang?
- Expect-like functionality to IO.gets?
- How to stub (or prevent running) of a call to a worker in my ExUnit test?
- Is Elixir's System.cmd blocking
- Elixir - Nested JSON parsing to structs
- What is the number that shows up after you define an anonymous function in elixir?
- Using System.cmd within a Poolboy worker (gen_server) causes silent failure
- How Can We Clear the Screen in Iex on Windows
Related Questions in PHOENIX-FRAMEWORK
- How to stub (or prevent running) of a call to a worker in my ExUnit test?
- Using System.cmd within a Poolboy worker (gen_server) causes silent failure
- Rails' before_filter equivalent in Phoenix
- How to Log something in Controller when Phoenix Server is running?
- Select Field in Phoenix Templates
- How to delete a Phoenix Session?
- Plug.Conn.assign not working when called from a Pipeline Plug
- Where can I put my Plugs and then use them from different controllers in my Phoenix app?
- How to get a variable value from Environment files in Phoenix?
- full text search for phoenix framework
- Print the record count using Phoenix/Ecto from the terminal
- In a Phoenix application, what is the difference between the :port key of the :http and :url configurations?
- Elixir/Phoenix multiple applications on same machine
- Using Elixir Plug.conn.assigns in multiple modules
- How to populate a database in Phoenix/Elixir on a server?
Related Questions in PARTIALS
- Undefined local variable in my partial, but I can't figure out why?
- Codigniter:Does a partial page get reloaded every time?
- Bootstrap modal sized incorrectly for content
- Load an HTML partial into a div using jquery
- EJS Include templates giving '`include` requires the 'filename' option.' Error even when filenames passed.
- Is there a precompiler for JavaScript like Sass?
- render doesn't know where to look for partials (from helper code)
- Angular partials not working
- gulp-compile-handlebars not finding partials
- Render partial located in child directory in Phoenix
- Add a class to breadcrumb item using partials
- jquery: load html from a file without html-encoding entity text? (such as '{{>' for use with Handlebars partial templates)
- Rails Partials - can't perform a collect on a symbol
- Express + Jade: render an array of partials
- Using jQuery Tokeninput within a nested form partial
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
You have to first modify your web/web.ex file to let it know to include subdirectories:
use Phoenix.View, root: "web/templates", pattern: "**/*"After making this change you can just use relative paths like so:
"icons/filename.html"Hope that helps!