tararoys / simple-documentation-process

Using Jekyll to simplify capturing documentation
2 stars 2 forks source link

Debugging broken links on April 1 Setting Up Jekyll Tutorial page #2

Open tararoys opened 10 years ago

tararoys commented 10 years ago

Last login: Tue Apr 1 18:46:55 on ttys003 ruby-2.0.0-p247 is not installed. To install do: 'rvm install ruby-2.0.0-p247' Taras-MacBook-Air:documentation-made-painless tlroys$ ls GettingStartedWithJekyllWebsites _posts _config.yml _site _includes css _layouts index.html Taras-MacBook-Air:documentation-made-painless tlroys$ script ~/Desktop/debugging_links_in_tutorial_page Script started, output file is /Users/tlroys/Desktop/debugging_links_in_tutorial_page bash-3.2$ echo "Bug: when I publish my website on github (by pushing my local copy of the repo to the gh-pages branch of my github repository) the links in http://tararoys.github.io/simple-documentation-process/jekyll/update/2014/04/01/setting-up-jekyll-tutorial.html do not work. When I try them on my local computer http://localhost:4000/jekyll/update/2014/04/01/setting-up-jekyll-tutorial.html They work. Today's first task is to figure out why." Bug: when I publish my website on github (by pushing my local copy of the repo to the gh-pages branch of my github repository) the links in http://tararoys.github.io/simple-documentation-process/jekyll/update/2014/04/01/setting-up-jekyll-tutorial.html do not work. When I try them on my local computer http://localhost:4000/jekyll/update/2014/04/01/setting-up-jekyll-tutorial.html They work. Today's first task is to figure out why. bash-3.2$ Echo "Step 1: Hypothesis. This is a repeat of the same problem I had with linking the css page. The jekyll folder on my computer is like my backyard. In order to do a project in my backyard, I can scatter tools all over the place. Because it is my backyard, jekyll knows to look in my backyard for the things it needs. The situation is a bit different on github. There, I have hundreds of projects. Github is like my warehouse/workshop. In order to keep all of the project bits in one place, github sticks each project website into it's on folder. A folder is like a special bench in the workshop/warehouse were all the things for a particular project go. I know this, but my intern jekyll oes not, and I did not give jekyll instructions saying 'put everything for this project on the bench called simple-documentation-process." Step 1: Hypothesis. This is a repeat of the same problem I had with linking the css page. The jekyll folder on my computer is like my backyard. In order to do a project in my backyard, I can scatter tools all over the place. Because it is my backyard, jekyll knows to look in my backyard for the things it needs. The situation is a bit different on github. There, I have hundreds of projects. Github is like my warehouse/workshop. In order to keep all of the project bits in one place, github sticks each project website into it's on folder. A folder is like a special bench in the workshop/warehouse were all the things for a particular project go. I know this, but my intern jekyll oes not, and I did not give jekyll instructions saying 'put everything for this project on the bench called simple-documentation-process. bash-3.2$ echo "In fact, I told him specifically that he could still put all of my reference books (i.e. the copies I made of every website I used to get started with jekyll anywhere in the warehouse. My warehouse manager, github, says to jekyll (oh no you don't) and, I hypothesize, puts the books back on the bench somewhere. However, Jekyll doesn't know this, so when a person goes to use the tutorial and clicks on a link, jekyll sent that person to the place he though he stashed the books. And the link appears broken." In fact, I told him specifically that he could still put all of my reference books (i.e. the copies I made of every website I used to get started with jekyll anywhere in the warehouse. My warehouse manager, github, says to jekyll (oh no you don't) and, I hypothesize, puts the books back on the bench somewhere. However, Jekyll doesn't know this, so when a person goes to use the tutorial and clicks on a link, jekyll sent that person to the place he though he stashed the books. And the link appears broken. bash-3.2$ echo "My first task is to check to see if github did in fact stick my reference books back on my project bench. I do this by checking to see if the url http://tararoys.github.io/simple-documentation-process/GettingStartedWithJekyllWebsites/002my-new-jekyll-site.html exists." My first task is to check to see if github did in fact stick my reference books back on my project bench. I do this by checking to see if the url http://tararoys.github.io/simple-documentation-process/GettingStartedWithJekyllWebsites/002my-new-jekyll-site.html exists. bash-3.2$ echo "Answer: yes, it exists. Github did in fact put all of my reference materials on my workspace." Answer: yes, it exists. Github did in fact put all of my reference materials on my workspace. bash-3.2$ echo "Now I need to check where jekyll is sending people to look for reference materials." Now I need to check where jekyll is sending people to look for reference materials. bash-3.2$ echo "Jekyll is sending them here http://tararoys.github.io/GettingStartedWithJekyllWebsites/002my-new-jekyll-site.html" Jekyll is sending them here http://tararoys.github.io/GettingStartedWithJekyllWebsites/002my-new-jekyll-site.html bash-3.2$ echo echo "Now I need to look at what the link actually looks like that jekyll generated." echo Now I need to look at what the link actually looks like that jekyll generated. bash-3.2$ echo 'It looks like this: a jekyll blog that looks like this' It looks like this: a jekyll blog that looks like this bash-3.2$ echo "I need to somehow stick /simple-documentation-proces/ into that href" I need to somehow stick /simple-documentation-proces/ into that href bash-3.2$ echo "That link has something called a relative path. A relative path is like knowing where someone is, so you can give them directions based on where they are. For example, if my brother knows I am at walgreens, he can tell me to walk one block southwest to get to the Jewel. An absolute path is more like nobody knows where the heck I am, so they give me the street address of the place I am trying to get to and let me figure it out." That link has something called a relative path. A relative path is like knowing where someone is, so you can give them directions based on where they are. For example, if my brother knows I am at walgreens, he can tell me to walk one block southwest to get to the Jewel. An absolute path is more like nobody knows where the heck I am, so they give me the street address of the place I am trying to get to and let me figure it out. bash-3.2$ echo "This is a good page on absolute and relative paths." This is a good page on absolute and relative paths. bash-3.2$ echo "http://www.coffeecup.com/help/articles/absolute-vs-relative-pathslinks/" http://www.coffeecup.com/help/articles/absolute-vs-relative-pathslinks/ bash-3.2$ echo "now, I think that github has some subtleties about absolute and relative paths because of the way their project folder stuff works. They assume that when you make a website on tararoys.github.io, you are going to actually have more than one website, because you have more than one project." now, I think that github has some subtleties about absolute and relative paths because of the way their project folder stuff works. They assume that when you make a website on tararoys.github.io, you are going to actually have more than one website, because you have more than one project. bash-3.2$ echo "so to make the project url unique, they make you toss everything in a folder with a special name. This is like a workshop manager giving you your own bench, and then telling you to keep all of your stuff on that one bench and not let it spread all over." so to make the project url unique, they make you toss everything in a folder with a special name. This is like a workshop manager giving you your own bench, and then telling you to keep all of your stuff on that one bench and not let it spread all over. bash-3.2$ echo "If I recall correctly, this folder in jekyll terms is called a baseurl." If I recall correctly, this folder in jekyll terms is called a baseurl. bash-3.2$ echo "So let's go see how I can tell jekyll what my workbench name is so he can label the links in my tutorial appropriately so that they actually go somewhere." So let's go see how I can tell jekyll what my workbench name is so he can label the links in my tutorial appropriately so that they actually go somewhere. bash-3.2$ echo "I am going to revisit my old friend http://jekyllrb.com/docs/github-pages/#project_page_url_structure for some tips" I am going to revisit my old friend http://jekyllrb.com/docs/github-pages/#project_page_url_structure for some tips bash-3.2$ echo "I found the error. The solution is to put the same site.baseurl liquid tag in front of the link as I did to link css. However, because I had code snippets with liquid tags in htem in my console log, and I wanted them to be code and not acutal liquid code substitutions, I wrapped every console log in raw liquid tags. This meant that code snippets with liquid in them would look like code snippets and not rendered liquid thingies. However, I was not very disciplined about where I stuck the endraw one, and so two of my links with liquid baseurl tags ended up inside a section that was saying, 'Seriously, jekyll. Don't do anything to this. Leave it as it is.' So jekyll did, and my links broke.

Oh, I should mention that I tried sticking the site.baseurl things ahead of my links before, but I ended up with a url that looked like this: http://localhost:4000/jekyll/update/2014/04/01/%7B%7B%20site.baseurl%20%7D%7D/GettingStartedWithJekyllWebsites/002my-new-jekyll-site.html

It should have looked like this: http://localhost:4000/GettingStartedWithJekyllWebsites/002my-new-jekyll-site.html

And it did, as soon as I got that url out of the liquid tag. " I found the error. The solution is to put the same site.baseurl liquid tag in front of the link as I did to link css. However, because I had code snippets with liquid tags in htem in my console log, and I wanted them to be code and not acutal liquid code substitutions, I wrapped every console log in raw liquid tags. This meant that code snippets with liquid in them would look like code snippets and not rendered liquid thingies. However, I was not very disciplined about where I stuck the endraw one, and so two of my links with liquid baseurl tags ended up inside a section that was saying, 'Seriously, jekyll. Don't do anything to this. Leave it as it is.' So jekyll did, and my links broke.

Oh, I should mention that I tried sticking the site.baseurl things ahead of my links before, but I ended up with a url that looked like this: http://localhost:4000/jekyll/update/2014/04/01/%7B%7B%20site.baseurl%20%7D%7D/GettingStartedWithJekyllWebsites/002my-new-jekyll-site.html

It should have looked like this: http://localhost:4000/GettingStartedWithJekyllWebsites/002my-new-jekyll-site.html

And it did, as soon as I got that url out of the liquid tag.

bash-3.2$ echo "Now the task is to put the baseurl code in front of every link and make sure they work." Now the task is to put the baseurl code in front of every link and make sure they work. bash-3.2$