There are several ways of hosting and distributing its files across global network (of course Github pages), self-owned VPS (i.e. AWS Lightsail or DigitalOcean). This time I have another way to do this. Amazon web services (AWS) with S3 bucket and further with CloudFront distribution.
Set up S3 bucket with static site
The very fist thing we need to do is to enable our S3 bucket serving our content out for global network. To do this we need to go to bucket properties and enable «Static Website Hosting». The most important part here is to set what default file should be root for certain folder. The problem is that CloudFront does not inherit this this for folders other than root. Basically what I want to enable is to have my content served as example.com/my-content1 or example.com/my-content2 for better SEO. And, to be honest I think that having .html in web-site address at the end is such a bad practise and smell 90s :)
It is not important (if you plan CloudFront) how your bucket available (permissions). I just disallowed all. Ok this is 50% of the challenge.
CloudFront distribution for web site
Now we almost ready for further set up. We need to create new distribution and add origin. Origin is the content. And my workaround is not to select the bucket itself (which is given as default option when you set origin by autocomplete), but bucket endpoint.
Why this is important? Well, if you really need to solve the challenge that I had (access subfolders with index.html files that Jekyll can generate when you set config.yml permalink as for example :slug/, what means it builds static post in it subfolder naming slug and pasting index.html inside).
Once CloudFront configured, you need to wait a bit ~ 10-15 minutes for caching across all selected edge locations of Amazon (look for "In progress" status, once it's gone, you can check).