github pages 404 jekyll sub pages - github

Sub pages fail to generate on GitHub, I get 404 errors, when I try to do the same on localhost:4000 it works.
Website Structure:
index.md
-us (folder)
--index.md
--test.md
-uk (folder)
--index.md
--test.md
On local it generates:
www.test.com/index.html
www.test.com/us/index.html
www.test.com/us/test/index.html
www.test.com/uk/index.html
www.test.com/uk/test/index.html
GitHub generates:
www.test.com/index.html
www.test.com/us/index.html
www.test.com/us/test/index.html - 404
www.test.com/uk/index.html
www.test.com/uk/test/index.html - 404
Any ideas?

If your site is in a project repository, his url is like username.github.io/repositoryName.
In _config.yml add baseurl: /repositoryName.
And set your link like this : [Link text]({{ site.baseurl }}{{ page.url }}).

Managed to fix this issue.
For some reason Github pages didn't like my initial structure,
Every subpage should be inside of it's own folder: www.test.com/us/test/index.md
I had to change website structure to it to:
www.test.com/index.md
www.test.com/us/index.md
www.test.com/us/test/index.md
www.test.com/uk/index.md
www.test.com/uk/test/index.md
www.URL.com/index.md - main index page.
www.URL.com/subfolder/index.md - subfolder
www.URL.com/subfolder/subfolder/index.md - 2nd subfolder

Related

How can I let Hugo detect theme?

I am trying out a Hugo theme and what happened was when I used the command hugo server, I see the following error message.
Building sites … WARN 2020/07/20 14:33:07 Page.URL is deprecated and will be removed in a future release. Use .Permalink or .RelPermalink. If what you want is the front matter URL value, use .Params.url
ERROR 2020/07/20 14:33:07 render of "taxonomy" failed: "D:\Hugo\bin\my_conf\themes\devfest-theme-hugo\layouts\_default\baseof.html:7:3": execute of template failed: template: taxonomy/list.html:7:3: executing "taxonomy/list.html" at <readFile "static/icons.svg">: error calling readFile: file "static\\icons.svg" does not exist
ERROR 2020/07/20 14:33:07 render of "home" failed: "D:\Hugo\bin\my_conf\themes\devfest-theme-hugo\layouts\_default\baseof.html:7:3": execute of template failed: template: index.html:7:3: executing "index.html" at <readFile "static/icons.svg">: error calling readFile: file "static\\icons.svg" does not exist
Built in 100 ms
Error: Error building site: failed to render pages: render of "taxonomy" failed: "D:\Hugo\bin\my_conf\themes\devfest-theme-hugo\layouts\_default\baseof.html:7:3": execute of template failed: template: taxonomy/list.html:7:3: executing "taxonomy/list.html" at <readFile "static/icons.svg">: error calling readFile: file "static\\icons.svg" does not exist
It seems saying that I misplaced some of the template files. I wonder if I have installed the theme correctly, or something I misunderstood?
What I have Done
Installed hugo and confirmed it is installed.
Created a new site called my-conf (Just trying out) and the themes directory.
I've cloned the repository into my themes directory. I am using GitHub Desktop on Windows.
Added the theme information using theme = "devfest-theme-hugo".
Used the command hugo server.
Ideally, you would add the themes as a submodule, as in the documentation, and the theme page itself:
hugo new site my-conf
cd my-conf
mkdir themes
git submodule add https://github.com/GDGToulouse/devfest-theme-hugo.git themes/devfest-theme-hugo
And add it to your configuration (which you seem to have done):
echo 'theme = "ananke"' >> config.toml
Then, regarding readFile:
To use the readFile function in your templates, make sure the path is relative to your Hugo project’s root directory:
{{ readFile "/content/templates/local-file-templates" }}
In the template: layouts/_default/baseof.html seems to have the right path.
Yet, looking at the history of GDGToulouse/devfest-theme-hugo/layouts/_default/baseof.html, I see it has changed during a commit "WIP 2020".
The version before that commit included:
{{ readFile "themes/devfest-theme-hugo/static/icons.svg" | safeHTML }}
Which, from the discussion, seems to work better!

How to get Codeigniter 3 to use project root instead of referencing full file path on localhost for key folders

I've looked around and I'm sure this is common but can't seem to get the right answer.
I've just recently set up a Codeigniter 3 project on my localhost and a migrating some Codeigniter 2 code.
The index.php file is a bit different.
I can get the project up and running except the main folders references in the index.php file such as APPLICATION and others I've added like "ASSETS" etc are loading like this:
<link href="http://[::1]/projectOne/E:\public_html\projectOne\assets\css\style.php?1537317115" rel="stylesheet" type="text/css" >
Even when I set a base_url:
<link href="http://localhost/projectOne/E:\public_html\projectOne\assets\css\style.php?1537317115" rel="stylesheet" type="text/css" >
I've checked it wasn't just the folders I added by echoing out the APPPATH variable:
define('APPPATH', $application_folder.DIRECTORY_SEPARATOR);
echo APPPATH;
Which produces:
E:\public_html\projectOne\application\
What am I missing here?
How do I get my paths to folder set in the index.php to just use the project root, and not the whole filepath on the computer?
Figured it out. For anyone else that hits this issue.
This new part in CI3:
if (($_temp = realpath($application_folder)) !== FALSE)
{
$application_folder = $_temp;
}
Allows you to more securely/easily have your application folder outside of the website root.
My additional ASSETS folder was then showing the full web path which you obviously don't want.
So commenting out this part leaving only:
$application_folder = strtr(
rtrim($application_folder, '/\\'),
'/\\',
DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR
);
And then setting you base_url value in the config.php file gives your CSS, JS and IMAGES proper site relative paths.

jekyll on github page has incorrect src (eg. "http://localhost:4000/assets/js/scripts.min.js")

My project: https://github.com/sebastian3495/sebastian3495.github.io
My website (current displayed without css rendered): https://sebastian3495.github.io/
How can I have all links point to my github project instead of localhost?
What am I missing? I am new to jekyll and web development isn't my strongest point, so please bear with me.
EDIT: My config file hasbeen updated
_config.yml
title: Blog Title
description: Describe your website here.
# put your disqus here
remote_theme: aron-bordin/neo-hpstr-jekyll-theme
disqus_shortname:
reading_time: true # if true, shows the estimated reading time for a post
words_per_minute: 200
logo: images/logo.png # logo visible in the topbar
excerpt_separator: <!--more-->
url: https://sebastian3495.github.io
# draw your top menu here
# each item must have a title and a url.
# To list post categories. use type: 'categories'
# To create sub categories. add a submenu item
# See the example
menu:
- title: 'Home'
url: '/'
- title: 'Fork'
url: 'http://github.com/aron-bordin/neo-hpstr-jekyll-theme'
- title: 'Install'
url: 'http://github.com/aron-bordin/neo-hpstr-jekyll-theme#installation'
- title: 'Tags'
url: '/tags'
- title: 'Categories'
url: '/categories'
type: 'categories'
- title: 'Favorites'
url: '#'
submenu:
- title: 'Code Highlighter'
url: '/intro/code-highlighting-post/'
- title: 'Sample Post'
url: '/intro/sample-post/'
# Owner/author information
owner:
name: Sebastian Nielsen
site: http://aronbordin.com
avatar: images/avatar.jpg
bio: "TEsting stuff off! . :D . It shouldn't be super long but a good two sentences or two should suffice."
email: you#email.com
# Twitter nick for use in Twitter cards and follow button.
twitter: aron_bordin # if no twitter in this config, the twitter follow button will be removed
# GitHub nick for use in follow button in author block.
github: aron-bordin
# Twitter account associated with the site if different from owner/author twitter account.
# Used in Twitter cards.
twitter:
# Social networking links used in author block underneath posts. Update and remove as you like.
social:
- title: "github"
url: "https://github.com/aron-bordin"
- title: "linkedin"
url: "https://br.linkedin.com/in/aronbordin"
- title: "youtube"
url: "https://www.youtube.com/channel/UCfnSek-9HPWOx5e2pH7VFgg"
# Background image to be tiled on all pages
background:
# Analytics and webmaster tools stuff goes here
google_analytics:
google_verify:
# https://ssl.bing.com/webmaster/configure/verify/ownership Option 2 content= goes here
bing_verify:
# http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
timezone: America/New_York
locale: en_US
future: true
highlighter: rouge
markdown: kramdown
sass:
sass_dir: _sass
style: compressed
# https://github.com/mojombo/jekyll/wiki/Permalinks
permalink: /:categories/:title/
# Amount of post to show on home page
paginate: 5
# if true, shows the floatting share buttons
float_share: true
# Octopress
# Default extensions
post_ext: md
page_ext: md
# Found in _templates/
post_layout: post
page_layout: page
# Format titles with titlecase?
titlecase: true
include: [".htaccess", "C:/Users/sebas/Documents/GitHub/Sebastian_Nielsen_Blog/_includes"]
exclude: ["demo/*", "lib", "config.rb", "Capfile", "config", "Gemfile", "Gemfile.lock", "README.md", "LICENSE", "log", "Rakefile", "Rakefile.rb", "tmp", "less", "*.sublime-project", "*.sublime-workspace", "test", "spec", "Gruntfile.js", "package.json", "node_modules"]
plugins: ["jekyll-paginate", "jekyll-remote-theme"]
theme: neo-hpstr-jekyll-theme
Since you're using a third-party theme, I understand you followed the instructions to run jekyll build locally first and then uploaded the contents of your ./_site directory.
The issue here is that recent versions of Jekyll automatically sets the url key to http://localhost:4000 when you build locally.
You have two basic choices:
To use both third-party themes and third-party plugins on GitHub Pages, you need to build the site locally by changing the JEKYLL_ENV env to production (or anything else other than development)
JEKLL_ENV=production bundle exec jekyll build
(on Windows, you need to run set JEKLL_ENV=production first followed by the jekyll incantation.
To use a third-party theme that requires only official plugins, and the theme-repo itself is also hosted on GitHub, you can use the remote_theme feature (included by default in recent versions of gem "github-pages"):
# _config.yml
remote_theme: aron-bordin/neo-hpstr-jekyll-theme
Refer: https://github.com/benbalter/jekyll-remote-theme for details on the jekyll-remote-theme plugin usage.
As you're pushing locally generated code, you need to :
In _config.yml, set url: https://sebastian3495.github.io
Run a bundle exec jekyll build
Push the resulting code to github.

Configuring VCS of Teamcity for code checkout

I am trying to specify rather complicated labeling rule in VCS of Teamcity. Not sure if what I am trying to do is possible or not.
This is my directory structure I have inherited.
mysvn/abc/repos
|
-TestDomain
-TestSystem
|
-MyFrameWork
-MySoftware
|
-MySoftwareDevices
-MySoftwareFiles
|
-branches
-tags
-trunk1
-MySoftwareDriver
|
- branches
- tags
- trunk2
I want to specify such a rule that in the working directory of the checkout directory of Teamcity has structure like this:
Teamcity checkout directory
|
-FolderA
-FolderB
Where FolderA has contents of trunk1 and FolderB has contents of trunk2.
Is it possible to be done?
SVN URL like:
mysvn/abc/repos/TestSystem/MySoftware/MySoftwareFiles/trunk1
does give me trunk1. But I need contents of trunk1 and trunk2 under two different folders in the same build checkout directory.
Labeling I have been using: trunk=>tags
Ok got the thing working. Its kind of hit and trial. Hoping someone comes up with proper explanations.
Labeling rules still has:
trunk=>tags
The SVN URL : mysvn/abc/repos/TestSystem
It is the checkout rules which I added:
-:.
+:MySoftware/MySoftwareFiles/trunk1=>MyDir/FolderA
+:MySoftware/MySoftwareDriver/trunk2=>MyDir/FolderB

Unable to run jekyll

I use Github pages to host my websites,I have test it on my local machine, and it works well, but when I push my sites on Github, I got an error. It says
The page build failed with the following error:
unable to run jekyll
My _config.yml file
---
auto : false
lsi : false
pygments : true
permalink : none
markdown : maruku
maruku:
use_divs: true
use_tex: true
png_engine : blahtex
png_dir : images/latex/
png_url : /images/latex/
I have searched the web, but can't find any useful ideas. Who can help me?
I have resorted to Github, they sent me the log, here is the error:
Maruku: Using extended syntax for div elements.\nMaruku: Using LaTeX extension. Images in images/latex/.\n/var/lib/gems/1.8/gems/maruku-0.6.0/lib/maruku/ext/math/mathml_engines/blahtex.rb:40:in convert_to_png_blahtex': Blahtex error: empty output (RuntimeError)\n\tfrom /var/lib/gems/1.8/gems/maruku-0.6.0/lib/maruku/ext/math/to_html.rb:64:in send'\n\tfrom /var/lib/gems/1.8/gems/maruku-0.6.0/lib/maruku/ext/math/to_html.rb:64:in render_png'\n\tfrom /var/lib/gems/1.8/gems/maruku-0.6.0/lib/maruku/ext/math/to_html.rb:120:in to_html_equation'\n\tfrom /var/lib/gems/1.8/gems/maruku-0.6.0/lib/maruku/output/to_html.rb:970:in send'\n\tfrom /var/lib/gems/1.8/gems/maruku-0.6.0/lib/maruku/output/to_html.rb:970:in array_to_html'\n\tfrom /var/lib/gems/1.8/gems/maruku-0.6.0/lib/maruku/output/to_html.rb:961:in each'\n\tfrom /var/lib/gems/1.8/gems/maruku-0.6.0/lib/maruku/output/to_html.rb:961:in array_to_html'\n\tfrom /var/lib/gems/1.8/gems/maruku-0.6.0/lib/maruku/output/to_html.rb:956:in children_to_html'\n\tfrom /var/lib/gems/1.8/gems/maruku-0.6.0/lib/maruku/output/to_html.rb:50:in to_html'\n\tfrom /var/lib/gems/1.8/gems/jekyll-0.11.0/bin/../lib/jekyll/converters/markdown.rb:120:in convert'\n\tfrom /var/lib/gems/1.8/gems/jekyll-0.11.0/bin/../lib/jekyll/convertible.rb:46:in transform'\n\tfrom /var/lib/gems/1.8/gems/jekyll-0.11.0/bin/../lib/jekyll/convertible.rb:84:in do_layout'\n\tfrom /var/lib/gems/1.8/gems/jekyll-0.11.0/bin/../lib/jekyll/post.rb:189:in render'\n\tfrom /var/lib/gems/1.8/gems/jekyll-0.11.0/bin/../lib/jekyll/site.rb:193:in render'\n\tfrom /var/lib/gems/1.8/gems/jekyll-0.11.0/bin/../lib/jekyll/site.rb:192:in each'\n\tfrom /var/lib/gems/1.8/gems/jekyll-0.11.0/bin/../lib/jekyll/site.rb:192:in render'\n\tfrom /var/lib/gems/1.8/gems/jekyll-0.11.0/bin/../lib/jekyll/site.rb:40:in process'\n\tfrom /var/lib/gems/1.8/gems/jekyll-0.11.0/bin/jekyll:250\n\tfrom /var/lib/gems/1.8/bin/jekyll:19:in `load'\n\tfrom /var/lib/gems/1.8/bin/jekyll:19\n"
From the log, We can see the problem is `convert_to_png_blahtex': Blahtex error: empty output (RuntimeError). I read the blahtex code,
if png.name != 'png'
maruku_error "Blahtex error: \n#{doc}"
return nil
end
But, png files are there. Anyone has encountered this problem?
I'm not sure the _config.yml file is the problem. I've pushed an invalid one to my site and the pages still render fine. That said, try removing your _config.yml all together. Github pages work fine without it for me. If the page still fails to render, you know it's something else.
Don't use maruku
maruku hasnt had an update since June 2010.
Personally I prefer kramdown.