ludovicchabant / PieCrust2

A simple yet powerful static website generator and lightweight CMS
Other
43 stars 8 forks source link

Site root behavior not consistent #10

Closed zimmicz closed 9 years ago

zimmicz commented 9 years ago

My config.yml looks as follows:

baker:
  processors:
  - imageoptimizer
  - cssmin
  - copy
jinja:
  twig_compatibility: true
site:
  author: Michal Zimmermann
  description: Pieces of knowledge from the world of GIS.
  category_url: category/%category%
  enable_gzip: true
  hide_quickstart: true
  post_url: '%year%/%slug%'
  posts_per_page: 10
  pretty_urls: true
  root: /posts
  tag_url: tag/%tag%
  title: Michal Zimmermann
  trailing_slash: true
smartypants:
  enable: true

In my HTML template, I use <h1><a href="{{pcurl(site.root)}}">Michal Zimmermann</a></h1> which should take me to the www.zimmi.cz/posts (as www.zimmi.cz is my root domain). It takes me to www.zimmi.cz/posts/posts instead.

Using <a class="pagination" href="{{pagination.next_page}}"> takes me to www.zimmi.cz/2 where it should take me to www.zimmi.cz/posts/2 instead.

<img src="{{assets.lines}}" title="Self-intersecting lines" class="img-responsive centered">

is translated to

<img src="/_asset/posts/2015-03-30_postgis-count-line-self-intersections-assets/lines.png" title="Self-intersecting lines" class="img-responsive centered"> on a localhost

and to

<img src="/postsposts/2015/postgis-count-line-self-intersections/lines.png" title="Self-intersecting lines" class="img-responsive centered"> on a production environment.

Is this a bug or is it my faulty settings?

ludovicchabant commented 9 years ago

Yeah I'm cleaning up the code around how URLs are passed around and processed, it's a bit of a mess right now.

Note however that {{pcurl(site.root)}} is incorrect. You either just use site.root, or pcurl('/'), or even pcurl(''). The pcurl function processes a simple URL by making it absolute, i.e. preprending site.root, and appending any debug stuff like ?!debug.

zimmicz commented 9 years ago

Alright, good to know. Anything I can do about the broken image src url?

ludovicchabant commented 9 years ago

Nope, I have to fix it :) Most problems should be fixed with 9b1de1f21627fdb887648fa5526734c19b156420, so you can pull and try again, but I'm still writing tests and chasing side effect bugs.