GitHub Pages: Octopress in Subfolder (other pages in root) - jekyll

I'm in the process of moving my blog from self-hosted Wordpress to (GitHub-pages powered) Octopress.
Thus far, I have successfully set up & copied my blog over to myusername.github.com, which has the CNAME http://mydomain.com. (So, browsing http://mydomain.com shows my Octopress blog. Dandy.)
I would like to modify my setup so that things are as follows:
http://mydomain.com → Simple html landing page
http://mydomain.com/blog → Octopress blog, in all its glory
http://mydomain.com/sdf → Miscelaneous other simple html sites that I would like to host
http://mydomain.com/sdfsdfdsf -> As above
... (an arbitrary number of other root-level sites)
However…I would like my landing page (and other misc sites) to be hosted from the GitHub-pages repo, and the source stored alongside Octopress.
Ideally, «octopress»/source/ would look like this:
«octopress»/source/index.html → My landing page
«octopress»/source/blog/* → Normal Octopress source folder (contains _posts, assets, _layouts, etc.)
«octopress»/source/sdf/index.html → Other misc sites
Thus far, I have found instructions about how to deploy Octopress to a subdirectory. But as far as I can tell, these instructions don't allow you to have other misc sites under «octopress»/source/.
I would love suggestions about how to accomplish what I'm after. I have a feeling it won't be hard (just tweaks to some Jekyll files somewhere, perhaps).
Many thanks,

You can change your blog index page to blog/index.html like the document describes. Then, put your landing page and other sites into /source directory.

If you are running Jekyll locally rather than using the version on the github server, you don't need to do everything within Jekyll - simply have a shell script move some folders around between the generate and deploy steps.
After Jekyll runs, everything is static files, and the deployment step is just committing and pushing whatever happens to be in the output folder at that point.

Related

Best way to add a Hugo blog to an existing static site?

The Situation
I have a website hosted on Netlify that consists of HTML and CSS files only. Let's call it "domain.com".
I want to keep that website the same, but add a Hugo blog only on "domain.com/blog/".
What I've Tried
I've created a folder called "blog" in my "domain.com" repository and copied over all of the Hugo stuff. Then I go to Netlify's build settings and told it use Hugo to build it. I don't think this works because it's looking for a config.toml file in my root folder, which isn't there, it's in the blog folder.
Then I tried creating a new Netlify site build from the /blog/ directory of the repository with the build setting "hugo --gc --minify". This doesn't work either and definitely doesn't put the the blog at "domain.com/blog/".
What I'm Wondering Now
Is this even possible?
Would I have to just start the whole thing from scratch and start from Hugo?
Is there a better way to create a CMS on "domain.com/blog/" that's free and not Hugo?
Since asking this question I have realized that it's not a good question. I'll keep it up though in case somebody has the same thought process as I did. It's not about getting Hugo onto an existing site, it's about getting your existing site onto Hugo.
I ended up porting my existing index.html and other pages with CSS over to Hugo. Basically I just copied those into the root of my Hugo site so they look exactly the same as they did before.
The only thing that is really generated by Hugo is the blog, which is the end result I needed.

Can't use Git Pages

TLDR: GitHub Pages isn't working.
I have a little knowledge on GitHub and tried multiple fixes to no avail. One repository is only showing readme file contents.
Please explain in lamest terms.
New to web development, I finally was able to complete my first site, but I'm unable to actually deploy the files for some reason; please forgive me, I literally have no idea what any of the git terminologies are.
I purchased a pro subscription in order to keep the repository private and the site public.
Every file is present in what seems to be the main root directory, but nothing is being actually presented.
I've created two different repositories in an effort to fix this, as I've seen different methods are available.
The first repository includes a README file because I was originally instructed to do so, however, all the site link does is present that README file's contents;
I also attempted to add a permalink fix within the file, but all it did was add that text to the other text presented.
The second repository in question literally greets me with nothing but a 404 error.
The solution I tried for the second repository was to have the repository name share my username as well since that seems to be where the site's link originates, but no present changes have occurred.
Finally, the waiting game solution hasn't beared any fruit yet either aside from updating the README file's contents.
All help is very much appreciated.
Check first:
Your GitHub repository name, which depends on the type of GitHub Pages you are creating
If you're creating a user or organization site, your repository must be named <user>.github.io or <organization>.github.io.
your GitHub Pages Publishing source
If you use the default publishing source for your GitHub Pages site, your site will publish automatically. You can also choose to publish your site from a different branch or folder.
You can add more pages to your site by creating more new files.
Each file will be available on your site in the same directory structure as your publishing source.
For example, if the publishing source for your project site is the gh-pages branch, and you create a new file called /about/contact-us.md on the gh-pages branch, the file will be available at https://<user>.github.io/<repository>/about/contact-us.html.
Make sure you have GitHub Pages enabled for every repository and that it's set to the branch you want to publish by checking your Pages settings at github.com/<user>/<repo>/settings/pages. If enabled, there should be a link on that page that takes you to the site.

Using default Hugo theme content through Netlify produces blank webpage, but works locally. blogdown

I have found the same/similar question to mine here: Create a new static page using blogdown with same hugo theme as main site but I cannot understand what the solution is as there seems not to be one explicitly, or I just do not grasp it.
I am an absolute beginner. I am testing the procedure to move generated code to netlify to produce a website.
I can put the public/post/2020-12-01-r-rmarkdown/index.html file into public/ folder in github and generate the example site on netlify e.g.:
https://github.com/hjhjonas/blogsite/tree/main/public produces
https://elastic-ptolemy-e2ba86.netlify.app/
However I plan to edit the default theme and use that instead. But the default index.Rmd file that produces the index.html file after i edit the yaml files and content files to use is like this:
https://github.com/hjhjonas/blogsite/blob/main/index.html
and produces a blank page on netfify.
But if I knit from Rstudio and serve_site() locally, it looks like this image attached, which is correctly what I need.
What I want to do is edit this original theme/layout and put the generated html into the public folder in github for Netlify to read.
The index.Rmd file that produces this local site is just
---
site: blogdown:::blogdown_site
---
I previous had a 404 error on netlify and followed these steps to realise that the html is required for Netlify to produce the deploy the page:
https://answers.netlify.com/t/support-guide-i-ve-deployed-my-site-but-i-still-see-page-not-found/125
This is the theme that I would like to use https://themes.gohugo.io/themes/hugo-lodi-theme/
I don't know how you generated the public/ folder, but it is not meant to be generated by manually copying or moving any files to it. If you publish a site via Netlify, there is no need to generate the public/ folder locally at all, because it can be automatically generated on Netlify.
First, delete index.html in the root directory, and please do not knit index.Rmd again in the future. Second, delete the public/ folder. After the two deletions, I think your site should appear on Netlify soon. If not, see if blogdown::check_site() has any recommendations.

Why won't Github Pages serve my documentation?

I use sphinx to build html documentation, and am in the middle of open-sourcing some of my company's private repos.
Internally, we serve documentation from an S3 bucket through Cloudfront so we can put access controls in front of it. But for open source, I figured publishing via Github Pages would be the path of least resistance.
However, I cannot get the service to work correctly.
Here is my repo, with my index.html in the /docs folder.
Here is the site, which is not applying any of the linked css, and with all page links broken.
I tried to isolate the issue by making a test repo with just the built documentation, and publishing from master.
As you can see, this one does not even try to serve the index.html, I just get a 404 page.
These files work both locally and when serving from AWS, so I'm a little at a loss for why Github Pages is not serving it correctly. I feel like I must be making some sort of dumb oversight. If anyone with more experience could take a look and point me toward the error of my ways I would really appreciate it. I'm a backend engineer for the most part so website logic is a little outside my normal wheelhouse. Thanks in advance!
To anyone else running into the same thing, I figured it out. Because I am pre-building the site in my CI/CD pipeline, I don't need jekyll to build the site for me, and need to add an empty config file for it.
From [here][https://www.docslikecode.com/articles/github-pages-python-sphinx/]:
Next, you set up the .nojekyll file to indicate you aren’t using
Jekyll as your static site generator in this repository.
Thank you for your help!
You need a _config.yml, and you need to enable github pages on Master for the repo (go to settings). After that, you also need a Gemfile it the following:
source 'https://rubygems.org'
gem 'github-pages'
Normally, the GitHub pages site needs to be in the root, and yours looks like it's in a /docs folder, so I'm sure you can Google how to do that. It might not be possible though with GH pages, I'm not sure.
If it must be a subfolder and not the root of the project maybe something like this would work: https://gist.github.com/cobyism/4730490
Heres whats in my _config: for barebones sites:
permalink: pretty
sass:
sass_dir: _scss
style: compressed
I'm sure you can leave sass out

Setting a GitHub pages site from a Jekyll-generated page

I cannot setup a new Jekyll-based GitHub pages site based on the tutorials I've read. Here is the full list of steps I took:
Ran jekyll new jek_test. This created a new dir.
Used GitHub desktop to create a git repository in that dir, then pushed it to a new git repository, jek_test.
In the project settings GitHub Pages panel, I choose master branch as source.
So far this had no effect I could see. Navigating to https://gadial.github.io/jek_test/ yielded a 404 error.
I added the following two lines to the projects Gemfile:
source "https://rubygems.org"
gem "github-pages", group: :jekyll_plugins
Now, after pushing to GitHub, the https://gadial.github.io/jek_test/ link is working, but the page loaded is obviously incorrect; the CSS is not loaded, the links are wrong, etc.
I guess I am missing several crucial steps, but all the tutorials I've found either go "simply push it and everything will be ok", or seem to assume I am not using a Gem-based theme, meaning all the layouts, css files etc. are explicitly stored in the _layouts directories etc.
Am I going about this the right way? What is the simplest method to get a Jekyll-generated site up and running on GitHub pages?
You are using minima which is the default so, that's not the issue but, if you have a look at your about.md you'll see that it is looking for a layout called page. You currently don't have a _layouts folder
Try creating a folder called _layouts and create a layout in that called page.html with however you want it to display the contents of all files with layout : page
The default page.html can be found here.
You will need to change url to "https://gadial.github.io" and baseurl to "/jek_test".
If this two attributes are not set up properly, Jekyll won't know where to look for your resources.