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

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.

Related

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.

Link in jekyll menu lead to "404 page not found" erros

I'm new to using jekyll and I think I'm missing something but I can't figure out what.
I built a jekyll page which I compile using
bundle exec jekyll build
then I uploaded the contents of the _site folder to the public_html/ folder of my webhoster (name.com).
All menu links, lead to 404 error pages: The menu links generated in the html files point to things like "https://myurl.com/people" while the actual file is called "people.html" so that is why I'm getting a 404. The way I see it, I either need jekyll to generate menu links that include the ".html" file extension, or somehow get my webhoster to serve "people.html" when "people" is requested.
Chris
To alter the link structure for all of your files, use permalink (with proper formatting) in your config file. For example:
# _config.yml
# same as `permalink: none`
# note that its ':output_ext' instead of '.html'
permalink: /:categories/:title:output_ext
Source: Official Docs

Edit Auto Generated Project Pages

I recently Created a few projects on GitHub and decided to use the Jekyll theme to make nice pages.
I went to my Project Repository and in the settings activated the Theme Cayman and I can access the page from: https://<username.github.io/<my_project>/
After I also wanted to create my username page so I also created: https://<username.github.io/
In this repository i have my index.html based on jekyll css and started creating my page.
However if I go to my Projects repository I can't find where the index.md or index.html is stored so I can modify it.
The Smite-Vb page is being created from the README.md, so you would just edit the README file.
If you click "Project site" and look at step 4 on this site: https://pages.github.com/ you'll see they describe editing the readme.
If you want to do something different, you could create a docs/ folder or a gh-pages branch, see here for more info:
https://help.github.com/articles/user-organization-and-project-pages/#project-pages

How to change paths and URLs in Jekyll?

I am very new to Jekyll and I am failing to find configuration to change the following:
I built a basic Jekyll site using jekyll new . and ran jekyll serve to learn and built a layout using Jekyll. The basic test site gives me the following URL for posts: /jekyll/update/2016/01/30/welcome-to-jekyll.html. Is the URL like that because I am running jekyll serve and not jekyll build? I want to remove the the jekyll/update from the URL path, so my final URLs for posts look like the following: /2016/01/30/welcome-to-jekyll.html.
I want my pages to be stored in a separate directory _pages instead of the root directory. How can I do that?
Is there way to prepend a path to files loaded from a specific directory? For example, I want to make a /_projects directory. Then add files with the following permalinks: /prj-test1, /prj-test2, /prj-test3. When compiled, I want to get the following URLs: /projects/prj-test1, /projects/prj-test2, /projects/prj-test3, respectively. Is this possible?
Yes, everything you asked is possible.
Take a look at these examples, you might want to choose one of them. But to do as you asked, you'll need to change the permalink to /:year/:month/:day/:title.html. To do that, add this line to your _config.yml file:
permalink: /:year/:month/:day/:title.html
It depends on the structure you want to achieve. You can use collections or simply create pages inside a folder called pages (without the underscore).
Yes. You can do that via collections, for example.
I recommend you to take a look at some templates, so you can see how the code works in different ways:
Try some Jekyll Themes here and here. Download them and study their structures.
If you want to go deep, take a look how Jekyll build its own website.
Hope to have helped!

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

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.