How to include images in a jekyll project hosted on github? - github

I'm building a blog using jekyll and hosting it on github with gh-pages. The root of my project can be see seen below:
├── LICENSE
├── README.md
├── _config.yml
├── _img
│   ├── 2016-09-09\ 14.48.20.png
│   └── 2016-09-09\ 15.25.09.png
.
.
.
├── _posts
│   ├── 2016-09-08-seven-weeks-before-applying-to-devops-job.markdown
│   └── 2016-09-09-an-hour-with-ansible.md
.
.
.
├── _site
│   ├── 2016
│   │   └── 09
│   │   ├── 08
│   │   │   └── seven-weeks-before-applying-to-devops-job.html
│   │   └── 09
│   │   └── an-hour-with-ansible.html
│   ├── LICENSE
│   ├── README.md
│   ├── about
│   │   └── index.html
│   ├── css
│   │   └── main.css
│   ├── feed.xml
│   └── index.html
├── about.md
├── css
│   └── main.scss
├── feed.xml
└── index.html
The documentation gives the following example:
Because of Jekyll’s flexibility, there are many solutions to how to do this. One common solution is to create a folder in the root of the project directory called something like assets or downloads, into which any images, downloads or other resources are placed. Then, from within any post, they can be linked to using the site’s root as the path for the asset to include. Again, this will depend on the way your site’s (sub)domain and path are configured, but here are some examples (in Markdown) of how you could do this using the site.url variable in a post.
Including an image asset in a post:
... which is shown in the screenshot below:
![My helpful screenshot]({{ site.url }}/assets/screenshot.jpg)
I've tried several different ways but non are working once I push gh-pages up:
![]({{ site.github.url }}/_img/2016-09-09 14.48.20.png)
![]({{ site.url }}/_img/2016-09-09 15.25.09.png)
I've also tried "keeping" the _img directory by putting the following in my _config.yaml
# Build settings
markdown: kramdown
keep_files: ["_img"]
But this also is not working. So how do I include images in a jeykll project hosted on github?
Thanks for your help :)

Every folder beginning with an underscore won't be copied to the build destination. The most common way is to store images is to add them to a assets/img folder.
If you want to use _img you have to add to your _config.yml:
include:
- "_img"

Create a folder for your images, you can name it according to your wish (mine is "images")
Find the image address of that image that you want to include in your post
(You can do that by going to your folder image and right click on your image, then copy image address)
Now you use that address in your post without any problem.

Related

Using GitHub Actions in a Single Repository with Multiple Projects

I am fairly competent in using GitHub actions to build a variety of languages, orchestrate deployments, and I've even done cross-repository actions using web-hooks, so I'd say that I'm pretty familiar with working with them.
I often find myself doing a lot of scratch projects to test out an API or making a demo, and these don't usually merit their own repositories, but I'd like to save them for posterity, rather than just making Gists out of them, Gists being largely impossible to search. I'd like to create a scratch repository, with folders per language, like:
.
└── scratch
├── go
│   ├── dancing
│   │   ├── LICENSE-APACHE
│   │   ├── LICENSE-MIT
│   │   ├── main.go
│   │   └── README.md
│   ├── gogettur
│   │   ├── LICENSE-APACHE
│   │   ├── LICENSE-MIT
│   │   ├── main.go
│   │   └── README.md
│   └── streeper
│   ├── LICENSE-APACHE
│   ├── LICENSE-MIT
│   ├── main.go
│   └── README.md
├── node
│   └── javawhat
│   ├── index.js
│   ├── LICENSE-APACHE
│   ├── LICENSE-MIT
│   └── README.md
└── rust
├── logvalanche
│   ├── Cargo.toml
│   ├── LICENSE-APACHE
│   ├── LICENSE-MIT
│   ├── README.md
│   └── src
├── streamini
│   ├── Cargo.toml
│   ├── LICENSE-APACHE
│   ├── LICENSE-MIT
│   ├── README.md
│   └── src
└── zcini
├── Cargo.toml
├── LICENSE-APACHE
├── LICENSE-MIT
├── README.md
└── src
I'd like to generalize GitHub actions per language, for Go, use go test ./... and go build, for Rust cargo test and cargo build, etc.
I know that what I could do is have a workflow for each created project, but this would be tedious, I'd end up copying and pasting most of the time, and every build would run on every change in the entire repository, and I don't want to be building node/javawhat if only rust/zcini has changed.
Therefore I have a few questions:
Is it possible to have a workflow only run when certain files have changed, rather than running everything every single time?
Is there a way to generalize my workflows so that every dir in rust/ uses the same generic workflow, or will I need one workflow per project in the repository?

How do I make Sphinx documentation play nicely with GitHub pages?

I am trying to elegantly setup my Sphinx to work with GitHub pages. I want to maintain separate build and source directories (seen in the directory tree below).
repository
├── docs
│   ├── build
│   │   └── index.html
│   ├── Makefile
│   └── source
| | ...
|
├── README.md
└── src
| ...
I have the GitHub repository set to look for the index.html in /docs/.
Question: Is there a way to place a symbolic link or an index.html in the root of /docs/ that points to /docs/build/index.html?

Is there way to make links between files or directories on AEM-Assets?

I use AEM6.2 Assets.
Is there way to make links between files or directories without programing? (like symbolic link)
I want to make "assets/B/photos" in the following.
assets/
├── A
│   └── photos
│   ├── 01.jpg
│   └── 02.jpg
└── B
└── photos -> ../A/photos/

Including directories for doxygen documentation

I have a collection of .dox documentation files for my project
in a dox directory as illustrated below
In the input section I have included ../ for doxygen to pick up the source code. However when I put ./ it does not pick up my documentation files and have to include each file. Is there a way to include them automatically?
Here is the docs and lib directories. In lib I have the source code, whereas in docs I have the documentation.
../
├── docs
│ ├── dox
│ └── Doxyfile
└── lib
Here is the contents of the dox directory
./dox/
├── gnu_affero_gpl.dox
├── gnu_fdl.dox
├── gnu_gpl.dox
├── larsa
│   └── larsa_core.dox
├── larsa.dox
├── meidum
│   ├── lattices
│   ├── lattices.dox
│   ├── lattices.dox~
│   ├── polyhedra
│   └── polyhedra.dox
├── meidum.dox
├── modules.dox
└── vikingr.dox
I have now fixed the problem. The solution was to remember to add *.dox in FILE_PATTERNS variable in Doxyfile.

web.py, How to share the base_base_template among subapps?

In order to reduce the superfluous codes,I want to share a base template among many
subapps,
Example dir tree
├── admin
│   ├── __init__.py
│   ├── templates
│   │   └── admin.html
│   └── view.py
├── base_templates
│   └── base.html
└── view.py
Now , I am using dir package styel as a sub app(I dunno whether it's a right way to do this). Above,
I am going to use base.html template in admin app, so
foo.py
render = web.template.render(...) # the render
class Foo:
def GET:
return render.admin()
any way to resolve my trouble ? thx
You can do this using a site layout template.