Bootstrap Css Location And Github Pages
I'm trying to upload a webpage to github pages using jekyll and want to make sure all my pages and posts 'see' the bootstrap 3 stylesheets, which in my working directory is simply
Solution 1:
You probably have solved the issue, but to future readers: Yes, the solution is to include direct path due to github project pages' url structure. The following excerpt is taken out from Jekyll docs.
Project Page URL Structure
Sometimes it’s nice to preview your Jekyll site before you push your gh-pages branch to GitHub. However, the subdirectory-like URL structure GitHub uses for Project Pages complicates the proper resolution of URLs. Here is an approach to utilizing the GitHub Project Page URL structure (username.github.io/project-name/) whilst maintaining the ability to preview your Jekyll site locally.
- In _config.yml, set the baseurl option to /project-name – note the leading slash and the absence of a trailing slash.
- When referencing JS or CSS files, do it like this: {{ site.baseurl }}/path/to/css.css – note the slash immediately following the variable (just before “path”).
- When doing permalinks or internal links, do it like this: {{ site.baseurl }}{{ post.url }} – note that there is no slash between the two variables.
- Finally, if you’d like to preview your site before committing/deploying using jekyll serve, be sure to pass an empty string to the --baseurl option, so that you can view everything at localhost:4000 normally (without /project-name at the beginning): jekyll serve --baseurl ''
Post a Comment for "Bootstrap Css Location And Github Pages"