Creating a new Blog with Octopress - octopress

I am reading this tutorial to create a new blog using the octopress
http://octopress.org/docs/setup/
I have successfully installed all the reuqired software and also created a heroku account.
I have also completed this step of configuring octopress with heroku
http://octopress.org/docs/deploying/heroku/
Now I am at the step where I have to configure the _config.yml file.
http://octopress.org/docs/configuring/
I am a little confused here as to what should I really put in this file.
Can anyone share a sample or some guidance on how can I complete this step and go about my first post?

This is how I have it for an Octopress in Heroku:
In the config.yml fill in your url, title, subtitle, author, description
The rest of the defaults should work.
If you have a custom domain you have to add a CNAMe file.
To create a new post you use rake as in rake new_post['Name of awesome post']
Then open that post. It is under the folder source/_posts
Add contents after the yml header
Save file.
Then follow the steps of deployment.
I documented an octopress to heroku deployment on my blog here:
http://www.tomordonez.com/blog/2012/07/22/set-up-a-blog-with-an-html5-template-in-octopress-and-heroku-cloud-service/
There is no mystery to it. If you have more questions tweet me #tomordonez or reply back with your results

Related

Use multiple themes on one website jeykll

I have recently found out about jekyll, and want to make a project landing page with it. I would like to have a home page using one theme (e.g. ubuild) and have another page for the docs (accessed via a navigation bar at the top) that uses a different theme (e.g. just-the-docs). How can I go about doing this?
EDIT: I want to use Github Pages for this.
Since you plan to use one of the themes on just a single page, I think the best solution would be to use two base layouts instead of two themes.
It will take some minor work initially, but will greatly ease future maintenance.
First set up the site to render just-the-docs theme for all pages including the landing page. Then modify _layouts/home.html to be a parent layout (like the default layout)
to render the markup from the ubuild.. theme.
I solved this with help from #JoostS's answer but with a few modifications:
Make an organization on GitHub pages with a repo called <org-name>.github.io. This repo should contain the theme for the home page (ubuild in my case) and all the content for it.
Make another repo with a jeykll site, called docs. This site should have the theme you want for the other page (just-the-docs in my case) and all the content along with it.
In the docs repo, add baseurl: "/docs" to your _config.yml
The <org-name>.github.io repo, should now be hosted at <org-name>.github.io/:
The docs repo should now be hosted at the <org-name>.github.io/docs url:
To link to the docs page, you should just be able to use /docs now.
The solution is to create two separate websites. The first site contains just the homepage and should be deployed to the root of your web folder. The second site contains all docs and should be deployed to a subdirectory, like '/docs/'. You might want to use baseurl for this: https://byparker.com/blog/2014/clearing-up-confusion-around-baseurl/
I do not think you can use this solution on Github pages. You can TRY to add the same CNAME to both repositories, as I am not 100% sure. Any other static hosting environment should work.
You can link from the docs to the homepage by linking to '/'. You can link from the homepage to the docs by linking to '/docs/pagename/' (assuming you use permalink: pretty).
The simplest way to maintain two layouts on the same site using Jekyll with GitHub Pages is for you to create a new repository for the new layout, so the main site is in a GitHub organization and the pages that need to use a different layout must be in your repositories.
However, if you are not using GitHub, just jekyll, just configure each folder as a new Jekyll project, and direct them to write to the respective subfolders in the _site folder. For everything to work out you need to start Jekyll Server from the main folder, and then build each subfolder separately, so it will update without removing the main one

create a page for each category automatically in Jekyll

How can I create a page for each category automatically in Jekyll ?
example:
the url of the post : https://UsrNm.github.io/Category1/Category2/2018/02/16/Post1.html
I want when I go to link like: https://UsrNm.github.io/Category1/Category2/
Get All posts in category Category1 and Category2
or when I go to link like: https://UsrNm.github.io/Category2/
Get All posts in category Category2 only
You can't do this automatically.
Well, you have 2 options:
The Jekyll way and the hackish way.
In pure Jekyll way you will need to create pages manually for each category, even if you have posts with multiple categories. Note that Jekyll doesn't have dynamic routing for this.
In hackish way you could use Javascript to read the parameters in url and show/hide needed content. Idea is to render all of the posts(hidden by default) and create identifiers on them, proper way to do this would be adding html attribute data-category=cat1 and say that you have url like this
/category?categories=cat1,cat2. You could then get categories from url and add logic in javascript to show just the ones that are actually in that categories.
Hope that helps
You can use the gem jekyll-archives to do this kind of work, which is a plugin of jekyll.
Or if you want to do this manually, you can read this guide
You can see the example of my site
Tips: Github Pages do not support this. Thus, if you want to deploy this on Github pages, you can convert site to static files and push only _site dir to the repo, which has been mentioned at here :)

Getting 404 on landing page for Octopress on Github

I followed Octopress original documentation and this blog to setup on Github pages. However once I deploy it and go to my blog url I'm getting 404.
I verified the setup by running it locally on port 4000 and it's fine. Would appreciate any help to make it work. Following is the link for the source file.
I see you GitHub page at https://github.com/aniruddhabarapatre.
So your GitHub pages should be at http://aniruddhabarapatre.github.io/, not http://aniruddhab.github.io/.
The article you reference does mention:
Create a new GitHub repository. If you are creating a personal blog create a repo called:
username.github.com
With 'username' being your GitHub account username (here aniruddhabarapatre).
Project pages (mentioned by Joel Glovier in the comments) is a good fit for your case, allowing you to:
define a gh-pages branch in your https://github.com/aniruddhabarapatre/aniruddhab.github.io repo
find the content of that branch published in http://aniruddhabarapatre.github.io/aniruddhab.github.io (meaning you might want to change the name of that aniruddhab.github.io repo)
But the idea remains: you already have one User Page. You cannot define a second one with the same account. Only project pages (one main page per project).

jekyll plugin not work on github

I want to change the order of pages in navitation bar by using jekyll-plugins / weighted_pages.rb from here.
This plugin work very well on my localhost but github.
I find the navitation bar is empty on github host, which seems this plugin does not work.
How can I solve this problem?
I copy weighted_pages.rb code below:
# Generates a copy of site.pages as site.weighted_pages
# with pages sorted by weight attribute. Pages with no
# weight specified are placed after the pages with specified weight.
module Jekyll
class WeightedPagesGenerator < Generator
safe true
def generate(site)
site.config['weighted_pages'] = site.pages.sort_by { |a|
a.data['weight'] ? a.data['weight'] : site.pages.length }
end
end
end
Add weight attribute to the front matter of your pages (like weight: 1) and use site.weighted_pages instead of site.pages in your loops.
Github pages does not support plugins. From jekyll's documentation:
GitHub Pages is powered by Jekyll, however all Pages sites are generated using the --safe option to disable custom plugins for security reasons. Unfortunately, this means your plugins won’t work if you’re deploying to GitHub Pages.
The same documentation page also gives you a workaround:
You can still use GitHub Pages to publish your site, but you’ll need to convert the site locally and push the generated static files to your GitHub repository instead of the Jekyll source files.
Currently, Github pages does not support some custom plugins.
If you want to make Jekyll site run as if it were local, such as let the custom plugins work properly, here is a way really convenient to build and deploy the Jekyll site to Github Pages.
jekyll-deploy-action - 🪂 A Github Action to deploy the Jekyll site conveniently for GitHub Pages.
https://github.com/jeffreytse/jekyll-deploy-action
With this action, I think your issues can be settled perfectly.

How can I read in project readme.md's into a user.github.com site?

Github now has automatic page generation for projects. Thats brill - it reads in the readme.markdown file in the project root and creates a neat site using a template.
The thing missing though is user.github.com pages. Is there anyway to (either automatically or by passing a config file) read in all of my current GitHub projects readme documents and push into a site design for a user.github.com template system??
Thanks!
The 'user.github.com' sites are built via GitHub Pages. They are independent repositories, the name of which matches the domain where they will appear. For example, my github username is 'alanwsmith'. I've got a repo called 'alanwsmith.github.com' which is processed via jekyll and available at: http://alanwsmith.github.com/.
Since they are independent and valid repositories, the GitHub doesn't apply any automation to them. The processing via jekyll only outputs the site. It doesn't mess with the contents of the repo itself. If you want to automatically list all your project Readme files on your user.github.com domain, you'll have to build your own process to gather the files and drop them in the source repo.
Of course, your individual user page (e.g. https://github.com/alanwsmith instead of http://alanwsmith.github.com/) lists your repos. Those links point to the individual project pages which, as you mention, display the readme files. I think that's as close as GitHub gets to doing what you want at this point in time.
More details on GitHub Pages can be found in the GitHub Pages Help section.

Resources