Sharing GitHub pages templates and designs across project pages - jekyll

What is the best approach to organizing GitHub pages so that I can define common elements (Jekyll templates, includes, CSS, JS) at the User/Organization level and leverage them in Project specific gh-pages sites.
I would like to keep the _posts and pages separate between projects.

GitHub Pages support submodules, this way you could move any folder to its own repo (or another branch of the current repo).
This way you could reuse all the folders you want across many gh-pages repos, the only problem would be they won't update dynamically, so you would need to up the submodules in all the repos to use the latest code from them. Because of this you could want to use the static assets (CSS, JS) from either a single gh-pages instance, or move them to any non-github CDN.

Related

Does minima dark skin work on github pages?

I'm trying to set up a blog via Jekyll and GitHub Pages. To deploy it was not such a big deal, however, in trying to follow the steps described here I only managed to make it display the dark skin locally. Is there a way to deploy it on GithubPages as well?
I installed it via
gem "minima", git: "https://github.com/jekyll/minima"
then added the following two lines in _config.yml
minima:
skin: dark
This is the repo holding the ruby code.
i had this problem too. I learned that the software used by github pages isn’t updated often, hopefully for stability reasoning. You can check what versions they use at https://pages.github.com/versions/. The newer version of minima has the alternative “skins” sass/css feature, but the one currently on github pages doesn’t—-heck, github pages still hasn’t updated Jekyll to v4!!... You should be able to see the build error by clicking Actions on the github repo, then clicking on the last “workflow”, then click on the red-colored build. It’ll say the key in the config file doesn’t exist or somethin’ like that, on the skin: dark line.
anyway, in the config file, add remote_theme: jekyll/minima to force download the latest version from the github repo upon rebuild. Don’t use ~jekyll-theme: minima (or whatever it’s called). In fact, at the moment, all of the themes that come pre-installed with github pages are quite old now...
but really though, use the jekyll discussion site https://talk.jekyllrb.com/.
I was using Chrome, and apparently the Clear browsing data in the last hour with Cookies and other site data and Cached images and files checked made the local updates appear live.
You can go even further and make your jekyll/minima powered site respect users theme preference
https://alexander-taran.github.io/2022/06/08/adopting-dark-theme-in-jekyll-blog.html

How to organize Web Development using Git

Web Developers!
How do you go about organizing your Github projects for your front-end and back-end?
For example, I have a python script that generates a JSON file that the front end JavaScript consumes to generate data on the pages.
Would you create one repository with two directories labeled front-end and back-end?
Or would you make two different repositories?
I'm interested in what developers do in the wild. Because up until now I found myself having a complete clone of my website in a directory on my desktop PC, and just pushing individual files via SFTP from there.
I'm getting to the point where I have enough *.old files that I want to implement version control so I can view much older states of code with Metadata like date and user that edited it.
The answer is yes. Make two different github projects.
Just Like Michael W has stated, "[...] this is highly opinionated". What I find to be the most common approach is to implement a single github project when still in development and especially when you're developing on your own. This is useful because you don't have to switch up between repositories and/or branches, which saves time.
Another common approach is to split them up. However this approach is only possible when both projects can run independent from one and other. In your case it's important to split the project logically. If the python project only generates JSON files and places them on a server location, then I would place that into it's own github project, because the main purpose is to generate files, so the python application can run on a server seperate from the frontend. If the webapp only consumes the JSON files through maybe a rest call or through a connection to a FTP, then also that can be placed within it's own project.

How do I upload new posts with an admin panel to a Github-hosted webpage?

I have a webpage, actually a blog, posted with Github Pages. It's a simple HTML&CSS page. Normally, I create new files with my new posts in them and upload these files to my repository. However, I want to create an admin panel. Especially in order to post easily, and manage my blog (like adding tags, comments etc). I don't know where to start or what to use. I know how to program in C & C#, so it's not a problem if I have to learn a new language.
Any help would be appreciated.
You may be able to use a Headless CMS. These approaches normally are driven by git or some kind of API (you don't have to write any backend code) to add content to static sites such as yours. Although most of them work with markdown, so you may need some way to render the markdown into your HTML.
Headless CMS is normally used within Jamstack projects, so I'd suggest checking that out if that is something you're interested in.
I learned that I need server-side processing with languages like PHP or Phyton. However, Github Pages is a static site service and does not support dynamic web sites. So I will whether keep writing locally or consider another hosting services.

Can I view changes to a GitHub hosted page before committing to master?

I host a personal website using GitHub pages and I manage the process of changing and improving the site using Git.
My process is to make changes in a 'development' branch and push these to master.
I believe this is a standard process, but my question is:
Is there a way of seeing how the website changes before going through all the steps to merge with master? Or can I see and test this change earlier on, say in a test environment?
I have been trying to find an answer to this question for some time.
The closest I have got to an answer is here:
Can I run HTML files directly from GitHub, instead of just viewing their source?
However when using http://rawgit.com an index.md file only shows as markdown and when using http://htmlpreview.github.io/ all the markdown text appears bunched together. In both cases I can't see any styling as the website is structured using links to external styling sheets and Jekyll front matter.
How can I solve this and view the page as it is supposed to appear?
While your pages are hosted on GitHub, they are rendered differently depending on your GitHub pages settings.
If you are using Jekyll as a static site generator with GitHub Pages, you can then setup your GitHub Pages site locally with Jekyll.
The idea remain to check your pages before pushing to GitHub.

How to set assets folder of libgdx without creating an android project?

Is there anyway of doing it?
I can't find any tutorial related to it on google.
Libgdx doesn't enforce any particular hierarchy or folder naming conventions for keeping your assets such that Gdx.files.internal("myassets/libgdx.png") would work just fine on Desktop. However, Android projects do have a specific folder in its root named assets. The folder has to be strictly named "assets" as enforced by the Android project [1]. Therefore, it would be a better idea to lay your folder hierarchy the same way in other projects as well so that you won't have to make changes for individual platforms. A much better approach would be to just place your resources in the Android project and link them to other projects. This would allow you to update your resources in only one project and that would be reflected everywhere. This has been explained in detail here.
And as an informative note, start using AssetManager to manage assets for your Libgdx project as it would streamline asset handling to a great degree.
You really do not need to do anything. You can use any folder in the Desktop project root. For example:
texture = new Texture(Gdx.files.internal("myfolder/libgdx.png"));