<turbo-stream action="append" target="posts_list"><template>    <div class="postbit" id="295039" data-post-id="295039">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="christhekeele" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/christhekeele/120/1039_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  christhekeele
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group quote-modified" data-username="derekkraan" data-post="1" data-topic="57104">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/derekkraan/48/29985_2.png" class="avatar"> derekkraan:</div>
<blockquote>
<p>You would be able to use the sigil like this: <code>~MYAPP"/my_path"</code>.</p>
<p>This would make it possible for several sigils to be defined in a single module.</p>
</blockquote>
</aside>
<p>As a thought experiment, an interesting alternative would be to provide the desired router as a suffix.</p>
<p>You could hack around how sigils allow lists of characters at the end, to support things like <a href="https://hexdocs.pm/elixir/Regex.html#module-modifiers" rel="noopener nofollow ugc">Regex modifier flags</a> such as <code>~r/(^(?&lt;line&gt;.*?)$/m</code> for multi-line regexes.</p>
<p>Sadly, <code>~p"my_path"MyApp.Router</code> would not work because of how the <code>.</code> gets parsed; these modifiers only accept ASCII letters and digits. So we’re back to doing something like configuring an alias in your Router, but with even nastier metaprogramming to implement:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">use Phoenix.VerifiedRoutes,
  endpoint: MyApp.Endpoint,
  router: MyApp.Router,
  statics: MyApp.statics,
  sigil_specifier: "myapprouter"

~p"/my_path"myapprouter
</code></pre>
<p>which is frankly worse.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="295039" data-batch-url="/posts/batch_likers">
                        2
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/abandoned-proposal-for-multiple-p-sigils/57104/12">Post #11</a>
	                </div>
	            </div>
              <div id="likers-container-295039" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="295039"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-most-liked cat-most-liked" title="One of the top 3 liked posts in this thread!"></div>
  </section>
</div>
    <div class="postbit" id="295071" data-post-id="295071">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="sodapopcan" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/sodapopcan/120/34668_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  sodapopcan
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I am a mostly satisfied user of <code>~p</code> but this is a very valid criticism and one I have half-come across.  I’m not using multiple endpoints but I do have an <code>admin.</code> subdomain and was at first pretty confused how I was supposed to have links into my main app from admin only using <code>~p</code>.  So far I haven’t actually needed to do that but feel I’m going to run into this soon.</p>
<p>Using <code>path/3</code> as <a class="mention" href="/u/lostkobrakai" rel="nofollow">@LostKobrakai</a> pointed out is a perfectly acceptable solution as far as I’m concerned.  To throw out an idea to keep things more, uh, “sigily”, there could be a modifier <em>before</em> the path.  <code>~p</code> requires that paths start with a <code>/</code> so, that could be exploited to allow:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">~p"#{MyAppWeb.SomeOtherEndpoint}/path/to/#{thing}"
</code></pre>
<p>and for subdomains on the same router it could be something along the lines of:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">~p"admin./path/to/#{thing}"
</code></pre>
<p>The latter is certainly fairly ugly as I wrote it, but it could be something better than that</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">~p"#{:admin}/path/to/#{thing}" # ???
~p"admin//path/to/#{thing}"    # ???
~p"admin/path/to/#{thing}"     # ???
~p"admin.path/to/#{thing}"     # ???
</code></pre>
<p>Of course I’m sure people are then going to want to be able to specify both the subdomain <em>and</em> the host so there would likely have to be a syntax for that as well.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="295071" data-batch-url="/posts/batch_likers">
                        2
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/abandoned-proposal-for-multiple-p-sigils/57104/13">Post #12</a>
	                </div>
	            </div>
              <div id="likers-container-295071" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="295071"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-last-post cat-last-post" title="Last post!"></div>
  </section>
</div>
</template></turbo-stream><turbo-stream action="replace" target="load-more-container"><template><div id="load-more-container" class="load-more-container">
    <span class="all-loaded">— All posts loaded —</span>
</div></template></turbo-stream>