I am building a GitHub blog with FastPages.
The automated process to create articles from Jupyter notebooks is working fine. However, the "Subscribe" button at the bottom of the page points to https://my_git_account.github.io/My_FastPages_Blog/feed.xml, which leads to an error page saying, "This XML file does not appear to have any style information ..."
I have followed FastPages's instruction here, and checked this issue. Unfortunately, there were no clear answers.
I'd like to modify the "Subscribe" button to point to the RSS link (for example https://feedrabbit.com/?url=https://my_git_account.github.io/My_FastPages_Blog/feed.xml.
Any advice on how should I do this? As I struggled to find my way by modifying the _config.yml file and the index.html files, it was not working, as whenever I ran: make server. All the files were generated as before.
I really appreciate any help you can provide.
After a while, I found the answer by myself.
In case someone needs this, here is what I did:
I went to download the footer.html from Jekyll Git repo.
Next, I override its HTML contents:
<p class="feed-subscribe">
<a href="https://feedrabbit.com/?url=https:put_the_link_you_want_HERE">
<svg class="svg-icon orange">
<use xlink:href="{{ 'assets/minima-social-icons.svg#rss' | relative_url }}"></use>
</svg><span>Subscribe</span>
</a>
</p>
I hope the Fastpages team can update this solution, the Subscribe button in their template has been unused for so long.
I'm using jykell to create a personal website. Check it out here chrisCPO.com general feedback is welcome. Still a wip.
UPDATE: looks like some of the site root vars are not being rendered on added pages. Home link code is:
<a href="{{ site.baseurl }}">
which works but is being overridden on the additional page?
If you visit the site notice click on experience on the sidebar.Then try to go to the home page.
Issue is if I add a page like the docs say to I get all of my added pages in-site links are broken. They are rendering as
<a class="sidebar-nav-item" href="">Home</a>
instead of
<a class="sidebar-nav-item" href="/">Home</a>
notice the href.
note: both of these issues are on production only, everything works fine locally.
What is the correct way to add an additional page so everything works?
using jekyll 3.0
You need to set your CSS paths in your layout relative to the root of the site, like this: /css/style.css (notice the first slash). Then the choice for folders or no folders becomes irrelevant. Permalinks can be managed globally in the config file. See the docs.
For a Jeykll website hosted on GitHub I created a custom solution (no Jeykll plugin) to display all post links of a category on a page *. I use the setup of GitHub pages for local Jekyll builds and build with bundle exec jekyll serve locally. If visit http://127.0.0.1:4000 and push one of the hyper-link buttons Embedded, Hardware or Software in the left side-bar below Pattern Categories the post links are shown like expected.
However if I visit the website hosted on GitHub I get an "404 File not found" error. From the past I can remember that this could relate to a different handling of Jekylls permalinks in local and GitHub Pages builds. But I cannot remember in detail.
It would be great if someone could help me out.
* Sitenote: Right now instead of listing only the post links for a single category the post links of all categories are listed section wise. But that does not matter w.r.t. to this question.
The problem is that the website isn't located at the root level, so you need to use in _config.yml the base url:
baseurl: /design-pattern-references
Then make use of that setting generating full paths, e.g.: in _layouts/index.html
{{ post.title }}
Let's assume we have a rendered Jekyll post at domain.com/rendered-post/.
The source of the post resides in https://github.com/username/username.github.io/blob/master/_posts/2013-12-10-rendered-post-title.md.
Is it possible to automatically include a link to the source code page into the post when it is rendered?
The final result in the post should then be <a href='https://github.com/username/username.github.io/blob/master/_posts/2013-12-10-rendered-post-title.md'>View source code of this page</a>.
I found the solution using the page variable {{ page.path }} in my layout.
View source code of this page
renders
<a href='https://github.com/username/username.github.io/blob/master/_posts/2013-12-10-rendered-post-title.md'>View source code of this page</a>
I have created a gh-pages branch for a project that I am working on at GitHub.
I use Sublime text to author the website locally and my problem is that when this is pushed to GitHub, all the links to javascrips, images, and css files are invalid.
For instance, I have this in my head section.
<link href="assets/css/common.css" rel="stylesheet">
This works great locally, but it does not work from GitHub as the links are not resolved using the repository name as part of the URL.
It asks for:
http://[user].github.io/assets/css/common.css
when it should have been asking for:
http://[user].github.io/[repo]/assets/css/common.css.
I could of course put the repo name as part of the URL, but that would prevent my site to work locally during development.
Any idea how to deal with this?
You'll need to use Jekyll.
Copying verbatim from the relevant documentation:
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 ''
This way you can preview your site locally from the site root on
localhost, but when GitHub generates your pages from the gh-pages
branch all the URLs will start with /project-name and resolve
properly.
(Apparently someone figured this out only a few months ago.)
Which browser are you using? Are you sure that this happens? Because it shouldn't. If you include a relative URL in a link, it will get resolved relative to the URL of the document that contains the link. In other words, when you include
<link href="assets/css/common.css" rel="stylesheet">
in an HTML document at http://www.foo.com/bar/doc.html, the link to assets/css/common.css will get resolved by appending it to the prefix of the URL of the HTML document without the last part of the path (without doc.html), i.e. the link will resolve to http://www.foo.com/bar/assets/css/common.css, not to http://www.foo.com/assets/css/common.css as you claim.
For example, view the source of the Twitter Bootstrap webpage: http://twitter.github.io/bootstrap/. Notice the style links at the top, specified as <link href="assets/css/bootstrap.css" rel="stylesheet">. That link correctly resolves to http://twitter.github.io/bootstrap/assets/css/bootstrap.css, i.e. it does include the repo name.
You could just put this
<base href="/[repo]/">
inside of the <head> tag, and it solves the problem.
You could also improve this solution by setting:
<base href="{{site.baseurl}}" />
and then set site.baseurl to empty string for the local testing.
This should not be an issue anymore in Dec. 2016, 3 and an half years later.
See "Relative links for GitHub pages", published by Ben Balter:
You've been able to use relative links when authoring Markdown on GitHub.com for a while.
(that is from January 2013)
Now, those links will continue to work when published via GitHub Pages.
If you have a Markdown file in your repository at docs/page.md, and you want to link from that file to docs/another-page.md, you can do so with the following markup:
[a relative link](another-page.md)
When you view the source file on GitHub.com, the relative link will continue to work, as it has before, but now, when you publish that file using GitHub Pages, the link will be silently translated to docs/another-page.html to match the target page's published URL.
Under the hood, we're using the open source Jekyll Relative Links plugin, which is activated by default for all builds.
Relative links on GitHub Pages also take into account custom permalinks (e.g., permalink: /docs/page/) in a file's YAML front matter, as well as prepend project pages' base URL as appropriate, ensuring links continue to work in any context.
And don't forget that since August 2016, you can publish your pages right from the master branch (not always the gh-pages branch)
And since Dec. 2016, you don't even need Jekyll or index.md. Simple markdown files are enough.
It seems that Github Pages is not very responsive. Though it makes new files available immediately, modified files would not appear immediately due to caching or something.
After waiting 15 minutes or so, everything is fine.
Another option is to create a new repo specifically for the github.io webpages. If you name the repo as [user].github.io on github then it will be published at https://[user].github.io and you can avoid having the repo name in the URL path completely. Obviously the downside is that you can only have 1 repo like this per github user, so it may not suit your needs, I'm not sure.
The best option is now the relative_url filter:
<link href="{{ '/assets/css/common.css' | relative_url }}" rel="stylesheet">