How do i manage content workflow for hexo site? - github

I've used static site generators like jekyll and had it hosted through github pages just fine using prose.io as a content management system.
I decided I wanted to go with a site using Hexo static site generator, but I cannot seem to figure out a good workflow for publishing content.
To my understanding this is the following in how I'd have to do it:
write *.md text file
hexo generate
(optional) hexo serve (to see local content)
hexo deploy (to publish the public content to whatever site using config.yml). Can publish on amazon S3, github pages, etc
Is there another workflow other than this?
the way I've been doing it before with jekyll+github pages is simply
go to prose.io
Write content
save (which publishes ocntent)
Ideally I'd like to use hexo+github pages the same way I do with jekyll+github pages.
Basically, can github generate static files automatically like it does with jekyll / ruby packages?

I figured out my own answer and posted it on my blog
http://www.tangycode.com/Quick-Start-Guide-To-Hexo-Install/
It covers everything you need to know on how to set up a hexo blog site and manage content workflows

One approach I am trying myself:
prose.io or similar to write and save on github repository
travis-ci.org to build hexo site and deploy
This is how it works:
Edit document on your editor of love
Commit it to your repository
travis-ci.org detects the commit and start working
My .travis.yml do (among few other things) the follow:
npm install hexo-cli
npm install grunt-cli
npm install inside siteĀ“s repository (hexo plugins and dependecies)
hexo generate
grunt deploy-production
hexo deploy (I use this to have a historic of the site stored in the repo itself)
If your editor of choice can direct commit to github repository your have exact same experience you had with Jekyll on GH pages. The advantage here is that you can use third-part plugin what GH pages avoid.

Alternatively, you can use INSTANT, which is a content management tool that you can use on any static website. You just install their javascript and can directly edit content in your website (without any admin dashboard). It saves and serves the content from the client. Pretty neat.

The easiest way is to use a hosting provider like Netlify in combination with a headless CMS, for example Headless (full disclore: I created it).
Netlify can do the build process for you and during that build process, it can fetch content from a headless CMS. Whenever you update content in the CMS, then Netlify does a rebuild.
Then you have your website on the Netlify CDN, a real CMS for your content management and you never need to dive in your code or github files. And that's all for free.

Related

Automate the process of uploading a new build to a website. i.e. npm run build -> cpanel upload

I am managing a mostly static site through GoDaddy.
The site is a React single page application, that is still currently under development, and that occasionally needs content updating. The project folder is hosted as a public git repository.
My goal is to be able to automate the process of updating the site. Currently I need to:
npm run build
navigate to the build folder in windows file explorer
navigate to the public html folder in cpanel, in my web browser
delete the current build files
upload the contents of the build files into cpanel, folder by folder (cpanel will not allow me to upload subfolders)
I have looked through countless forum posts, and blogs, etc to find a way to automate this, but I always end up doing it manually.
You need to investigate using continuous deployment (CD/CI) and using a different hosting setup. Unfortunately, the type of platform that you use (with CPanel) is limiting and is not really oriented at your use case.
However, CPanel does have an option to use Git version control to manage the files and folders in your account. Go into this option and say "Clone repository", where you'll have to link a repo and say where it should install. Note: It is possible that your hosting provider has disabled this feature.
I suspect that this CPanel feature does not automatically pull in changes when you update the repo, so you would probably still need to manually clone the repo again when you make changes (which is still easier than copying files over). Also note that any data you store may be removed when cloning again.

Github page version number syntax

I have a github repo that is also a github page. I use it as a CDN like so:
https://agentscript.org/src/Model.js
(agentscript.org is a CNAME forwarder to backspaces.github.io/agentscript/)
I would like to access the code by release number. So for example something like:
https://agentscript.org#0.9.0/src/Model.js
Is there a way for me to do this? The above fails. Maybe a different syntax?
Note that npm publishing allows this to work on npm based CDNs like skypack or unpkg:
https://unpkg.com/agentscript#0.9.0/src/Model.js
https://cdn.skypack.dev/agentscript#0.9.0/src/Model.js
GitHub Pages doesn't offer a feature like this. The reason is that GitHub Pages is designed to host a personal website or a site for your open source project, but isn't designed to be a CDN. The documentation outlines that there are limits, so if you need a CDN, you need to host your project on an actual CDN.

Github page using hexo, how to get my theme supported?

I want to host a simple blog on Github pages. Therefore I set up a repository and used Hexo as a compile and deployment tool.
After testing my site locally I run the following command:
hexo deploy --generate
Sadly I, just a few seconds later, get the following message from Github:
The page build failed with the following error:
The hacker theme is not currently supported on GitHub Pages. For more
information, see
https://help.github.com/articles/adding-a-jekyll-theme-to-your-github-pages-site.
For information on troubleshooting Jekyll see:
https://help.github.com/articles/troubleshooting-jekyll-builds
If you have any questions you can contact us by replying to this
email.
How can I publish my site using the hacker theme? If this is not possible which themes are supported by Github? How do I use them with Hexo?
Bypassing Jekyll on GitHub Pages
It is now possible to completely bypass Jekyll processing on GitHub
Pages by creating a file named .nojekyll in the root of your pages
repo and pushing it to GitHub. This should only be necessary if your
site uses files or directories that start with underscores since
Jekyll considers these to be special resources and does not copy them
to the final site.
Source: https://github.com/blog/572-bypassing-jekyll-on-github-pages
[..] I used the username.github.io repo and deployed directly to master
and it works!
https://github.com/CodeDaraW/Hacker/issues/9

Update my website from a github repository

I use a website for testing purposes. Part of what I test is a public repository on GitHub. What I would like to do is have my site periodically check the repository and pull any changes to a folder in my site.
I'm using a LAMP server, is there some php and a cronjob that I can use to check and get the files from the repository?
I would use the webhooks Github allows. See here for a simple PHP example that executes a auto-pull if the Github repository gets updated.

How do I self-host Jekyll?

I don't want to use github to host my new portfolio, I want to host it from my own site. How do I do this properly? Clearly, simply uploading all the files don't work (I just see Jekyll template text).
Has anyone done this?
You have to generate the site with Jekyll, and then upload the generated files to your web server. Jekyll's Usage and Deployment docs explain in more detail.