Closed wichert closed 12 years ago
I had thought of "host" as colinta.com
or bigcompany.com
, though I like the idea of having just one configuration instead of two (host
and root_url
or whatever)
The example in the documentation already used a full URL, not just a hostname :)
just because I wrote it, doesn't mean I agree with it! HAH!
On May 3, 2012, at 3:39 PM, Wichert Akkerman wrote:
The example in the documentation already used a full URL, not just a hostname :)
Reply to this email directly or view it on GitHub: https://github.com/colinta/StrangeCase/issues/22#issuecomment-5499164
I'm trying to think of a reason to keep the host
config, and I can't think of any except particular use-cases, like comments. But those don't need host
per-se, it could be host
or hostname
or whatever.
This, though, is a required config - the url of the root node - and so I think that I will promote it to its own config, and drop host
altogether.
Sounds reasonable.
and it is so! root_url
config, available in v4.1.3
Actually there is one place where you do need the full host name: to generate URLs in feeds (Atom/RSS). That can also be done with a custom variable though (or even hardcoded in the template) - it does not have to be something strangecase itself requires.
That's the conclusion I kept coming to. It is certainly useful, and I use it myself, the default value (localhost:8000
) wasn't useful, and certainly wasn't used internally. Now, the user is free to call it anything they like!
Can you rename it to root_path? What you are specifying is not a URL at all, which is a bit confusing.
I would entertain a different name, but this config is inherently URL related (the only place it is used is in the RootFolderNode.url()
method), so I'd rather it include that in the name. path
sounds file-based to me.
url_prefix
?
It is URL related, but it is not a URL. A URL consists of multiple components: a mandatory scheme and set of scheme-specific components after a colon. For the most common schemes (http/https/ftp) you then have a network location, path, query string and fragment. The option you added only covers the URLs path component, hence my suggestion to use root_path. With the current naming as a naive use I would expect to be able (or even required) to specify http://my.site.com/sub1
, when in fact you must use /sub
.
Yes, absolute URLs are all that, but relative URLs are not, nor protocol-relative URLs. That is the crux of my argument.
At the level we are working with - HTML in a browser - we can be sloppy about URLs. We can leave off the protocol, or the domain, and the browser will figure out what is going on.
The only "thing" affected by this configuration is whatever you want to call the "thing" that goes in an href
or src
attribute of an <a>
or <img>
or <link>
element, and since that is universally called a URL, I think strangecase should follow suit.
And actually you can include the protocol and domain name in this configuration. You don't have to use /sub/
. The only requirement is that it ends in a slash (and I'm going to be checking for this soon).
Btw, there is a bug in v4.1.4 that prevents the root node from being set properly - so don't upgrade until 4.1.5. I'm going to add a full strangecase site generation test as well.
Reopening until a consensus is met.
You've convinced me that root_url is fine :)
I did find a buglet though: if you set root_url to something like /new
you get urls such as /newabout.html
. I suggest to add a trailing slash to root_url if it isn't already there.
cool, I'd be happy with "reasonable", but really glad to hear that it makes some sense.
Adding the slash - for sure, I'll push that up in a sec.
On May 7, 2012, at 3:25 PM, Wichert Akkerman wrote:
You've convinced me that root_url is fine :)
I did find a buglet though: if you set root_url to something like
/new
you get urls such as/newabout.html
. I suggest to add a trailing slash to root_url if it isn't already there.
Reply to this email directly or view it on GitHub: https://github.com/colinta/StrangeCase/issues/22#issuecomment-5561256
v4.1.8 adds a slash to the front and back of the root_url
config
Sometimes you may need to publish to a subsection of a site. That has an impact on URL generation: the URL for the root of the scase project must then be something other than
/
.I suggest to use the currently unused
host
configuration option to detect this: if it uses a non-empty path than prepend that to all generated URLs. Example: with a default host ofhttp://localhost:8000/
the root is/
, so all generated URLs should start that. If host is set tohttp://bigcompany.com/country/subsite
the root is/country/subsite
, and that should be prepended to all generated URLs.