Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deploying on GitHub Pages requires RELATIVE_URLS to be True. #1526

Closed
OrangeTux opened this issue Nov 10, 2014 · 12 comments
Closed

Deploying on GitHub Pages requires RELATIVE_URLS to be True. #1526

OrangeTux opened this issue Nov 10, 2014 · 12 comments

Comments

@OrangeTux
Copy link

When RELATIVE_URLS = False static files are not loaded. This should be mentioned in the docs.

@smartass101
Copy link
Contributor

I suggest you first debug your configuration before you make such claims. Only if you explain why exactly this is needed will this issue become important.

@OrangeTux
Copy link
Author

Assume you are using GitHub Pages for your project, your url to your GitHub Page looks like username.github.io/project. Your static files are located at username.github.io/project/theme/css/main.css. If you set RELATIVE_URLS=False, static links are generated which point to /theme/css/main.css, that is to the root of your user or organisation page.
So this settings needs only to be true when deploying your blog as a project page.

@smartass101
Copy link
Contributor

If you have SITEURL = 'http://username.github.io/project then for instance this line in the notmyidea base.html template will output by default http://username.github.io/project/theme/css/main.css. Maybe your theme does not correctly form that URL.

@smartass101
Copy link
Contributor

I had a look at your pelicanconf.py and publishconf.py in your blog repo. It seems you don't set SITEURL to the right string, GITHUB_URL is meant for something else. No wonder it isn't reflected in your templates.

@OrangeTux
Copy link
Author

You're correct. Thanks for pointing out.

@nacnudus
Copy link

I have the same problem here, set up with the default theme and SITEURL = 'https://nacnudus.github.io/crosstab-kiwi'.

@avaris
Copy link
Member

avaris commented Feb 14, 2015

@nacnudus, can you show your config file?

@nacnudus
Copy link

config and pasted below. Thanks for checking this out.

#!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals

# This file is only used if you use `make publish` or
# explicitly specify it as your config file.

import os
import sys
sys.path.append(os.curdir)
from pelicanconf import *

SITEURL = 'https://nacnudus.github.io/crosstab-kiwi'
RELATIVE_URLS = False

FEED_ALL_ATOM = 'feeds/all.atom.xml'
CATEGORY_FEED_ATOM = 'feeds/%s.atom.xml'

DELETE_OUTPUT_DIRECTORY = True

# Following items are often useful when publishing

#DISQUS_SITENAME = ""
#GOOGLE_ANALYTICS = ""

@avaris
Copy link
Member

avaris commented Feb 14, 2015

@nacnudus that's publishconf.py. In your pelicanconf.py, you have SITEURL = ''. How do you generate your site?

@nacnudus
Copy link

First I create an empty repository, then I do this:

(pelican)nacnudus@nactop:~% git clone https://github.com/nacnudus/crosstab-kiwi.git
Cloning into 'crosstab-kiwi'...
warning: You appear to have cloned an empty repository.
Checking connectivity... done.
(pelican)nacnudus@nactop:~% cd crosstab-kiwi
(pelican)nacnudus@nactop:~/crosstab-kiwi% pelican-quickstart                                                                ±[master]
Welcome to pelican-quickstart v3.3.0.

This script will help you create a new Pelican-based website.

Please answer the following questions so this script can generate the files
needed by Pelican.


> Where do you want to create your new web site? [.] 
> What will be the title of this web site? Crosstab Kiwi
> Who will be the author of this web site? Duncan Garmonsway
> What will be the default language of this web site? [en] 
> Do you want to specify a URL prefix? e.g., http://example.com   (Y/n) 
> What is your URL prefix? (see above example; no trailing slash) https://nacnudus.github.io/crosstab-kiwi
> Do you want to enable article pagination? (Y/n) 
> How many articles per page do you want? [10] 
> Do you want to generate a Fabfile/Makefile to automate generation and publishing? (Y/n) 
> Do you want an auto-reload & simpleHTTP script to assist with theme and site development? (Y/n) 
> Do you want to upload your website using FTP? (y/N) 
> Do you want to upload your website using SSH? (y/N) 
> Do you want to upload your website using Dropbox? (y/N) 
> Do you want to upload your website using S3? (y/N) 
> Do you want to upload your website using Rackspace Cloud Files? (y/N) 
Done. Your new project is available at /home/nacnudus/crosstab-kiwi
(pelican)nacnudus@nactop:~/crosstab-kiwi% pelican content -o output -s pelicanconf.py                                    ±[●][master]
WARNING: No valid files found in content.
Done: Processed 0 articles and 0 pages in 0.05 seconds.
(pelican)nacnudus@nactop:~/crosstab-kiwi% ghp-import output                                                              ±[●][master]
(pelican)nacnudus@nactop:~/crosstab-kiwi% git push origin gh-pages                                                       ±[●][master]
Username for 'https://github.com': nacnudus
Password for 'https://nacnudus@github.com': 
Counting objects: 36, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (22/22), done.
Writing objects: 100% (36/36), 25.07 KiB | 0 bytes/s, done.
Total 36 (delta 13), reused 36 (delta 13)
To https://github.com/nacnudus/crosstab-kiwi.git
 * [new branch]      gh-pages -> gh-pages
(pelican)nacnudus@nactop:~/crosstab-kiwi% 

@avaris
Copy link
Member

avaris commented Feb 15, 2015

Note that you're using pelicanconf.py:

(pelican)nacnudus@nactop:~/crosstab-kiwi% pelican content -o output -s pelicanconf.py  

And you don't have SITEURL properly defined in that. Either fix pelicanconf.py or use publishconf.py.

@nacnudus
Copy link

Aha, that works. In which case shouldn't http://docs.getpelican.com/en/latest/tips.html use publishconf.py, since it currently uses pelicanconf.py? I got the above script from the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants