瀏覽代碼

Make path of search.html absolute in search form action

search.html is always at root so its path should be absolute.

Thanks to @if1live for pointing it out.

https://github.com/if1live/pelican-elegant/commit/3da52903e94051fa771212149a10a271adc78264#commitcomment-3988674

> my pelicanconf.py is..
>
> ```
> ARTICLE_URL = 'posts/{slug}/'
> ARTICLE_SAVE_AS = 'posts/{slug}/index.html'
> ```
>
> what is problem?
> 1. goto article page. current url : /posts/some-article/
> 2. search. current url : /posts/some-article/search.html?... but search.html is in root path.
>
> search.html is always in root path. so you can use absoulte path.
Talha Mansoor 11 年之前
父節點
當前提交
331de4efe2
共有 2 個文件被更改,包括 2 次插入2 次删除
  1. 1 1
      templates/404.html
  2. 1 1
      templates/base.html

+ 1 - 1
templates/404.html

@@ -20,7 +20,7 @@ Page does not exist at {{ SITENAME|striptags }} blog.
         <p>Sorry, but the page you are looking for cannot be found. It seems that the page you were trying to reach doesn't exist, or may be it has just moved, or it no longer exists.</p>
         <p>The best thing to do is to use the search form or start again from the <a href="{{ SITEURL }}">home page</a>.</p>
         <div class="input-append">
-            <form action="search.html">
+            <form action="{{ SITEURL }}/search.html">
                 <input type="text" class="span12" placeholder="Search" name="q" id="tipue_search_input">
                 <button class="btn" type="button">Search</button>
             </form>

+ 1 - 1
templates/base.html

@@ -57,7 +57,7 @@
                             <li {% if page_name == "categories" %} class="active"{% endif %}><a href="{{ SITEURL }}/categories.html">Categories</a></li>
                             <li {% if page_name == "tags" %} class="active"{% endif %}><a href="{{ SITEURL }}/tags.html">Tags</a></li>
                             <li {% if page_name == "archives" %} class="active"{% endif %}><a href="{{ SITEURL }}/archives.html">Archives</a></li>
-                            <li><form class="navbar-search" action="search.html" onsubmit="return validateForm()"> <input type="text" class="search-query" placeholder="Search" name="q" id="tipue_search_input"></form></li>
+                            <li><form class="navbar-search" action="{{ SITEURL }}/search.html" onsubmit="return validateForm()"> <input type="text" class="search-query" placeholder="Search" name="q" id="tipue_search_input"></form></li>
                         </ul>
                     </div>
                 </div>