I have a base jekyll directory which looks like this:
├── 404.html
├── about.markdown
├── assets
│ └── img
│ ├── mapcolor360_dbc.png
│ └── SileHuPortrait.jpg
├── _config.yml
├── favicon.ico
├── Gemfile
├── Gemfile.lock
├── group-members.html
├── _includes
│ └── footer.html
├── index.markdown
├── _layouts
├── media.md
├── openings.md
├── _posts
│ └── 2019-12-18-welcome-to-jekyll.markdown
├── publications.md
├── research.html
├── research.md
├── _sass
│ └── _variables.scss
├── _site
│ ├── 404.html
│ ├── about
│ │ └── index.html
│ ├── assets
│ │ ├── img
│ │ │ ├── mapcolor360_dbc.png
│ │ │ └── SileHuPortrait.jpg
│ │ └── style.css
│ ├── favicon.ico
│ ├── feed.xml
│ ├── group-members
│ │ └── index.html
│ ├── index.html
│ ├── jekyll
│ │ └── update
│ │ └── 2019
│ │ └── 12
│ │ └── 18
│ │ └── welcome-to-jekyll.html
│ ├── media
│ │ └── index.html
│ ├── openings
│ │ └── index.html
│ ├── publications
│ │ └── index.html
│ ├── research
│ │ └── index.html
│ └── software
│ └── index.html
└── software.md
And I want to upload a photo to the group-members page, using this line in the group-members.html file:
<img src="/home/sam/Dropbox/Documents/PhD/hellenthal-group/assets/img/SileHuPortrait.jpg">
The image definitely exists in the directory, but when I try to compile the site with bundle exec jekyll serve
It returns the error
[2020-03-20 19:36:13] ERROR `/home/sam/Dropbox/Documents/PhD/hellenthal-group/assets/img/SileHuPortrait.jpg' not found.
And the image appears as broken. Can anyone help me with this issue?
I see that SileHuPortrait.jpg is actually inside <source>/assets/img based on your directory structure.
When Jekyll builds your site, the URLs generated are assumed to be used with a web-server.
So when you have a reference like /home/sam/Dropbox/Documents/.., the webserver is looking for /home/sam/Dropbox/Documents/.. relative to your destination directory (which is the _site folder).
The error you're seeing is because the physical path /home/sam/Dropbox/Documents/PhD/hellenthal-group/_site/home/sam/Dropbox/Documents/PhD/hellenthal-group/assets/img/SileHuPortrait.jpg
doesn't exist.
The correct usage would therefore be:
<img src="/assets/img/SileHuPortrait.jpg">
(Note the leading slash)
The above while correct, isn't flexible to automatically adapt when you set baseurl: in the config file.
So, the final solution is to use the relative_url Liquid filter:
<img src="{{ 'assets/img/SileHuPortrait.jpg' | relative_url }}">
Related
I have a simple Jekyll web site. It works as expected on the local server, but when uploaded to github it displays differently. I am guessing that this is because bundle exec jekyll serve behaves differently on github.
This is the way it looks on the local server (I'm using the theme minima)
and on github
The extra links in the menu-bar all point to pages on the website
index.md
---
layout: home
---
Welcome to the Psionman Set. This is a series of lessons that I wrote to help me get to grips with some new (to me) technology.
(Some were done for my private use, but you can read them).
[Wx Python from scratch]({{ site.baseurl }}{% link wx_python/wxpython_from_scratch.md %})
And the tree on the local server
.
├── 404.html
├── about.markdown
├── _config.yml
├── Gemfile
├── Gemfile.lock
├── index.md
├── _posts
├── _site
│ ├── 404.html
│ ├── about
│ │ └── index.html
│ ├── assets
│ │ ├── main.css
│ │ ├── main.css.map
│ │ └── minima-social-icons.svg
│ ├── feed.xml
│ ├── index.html
│ └── wx_python
│ ├── images
│ │ ├── basic_frame.png
│ │ ├── datepicker.png
│ ├── introduction.html
│ ├── post01.html
│ ├── post02.html
│ ├── post03.html
│ ├── post04.html
│ ├── snippets
│ │ ├── basic_frame.py
│ │ ├── basic_panel.py
│ └── wxpython_from_scratch.html
└── wx_python
├── images
│ ├── basic_frame.png
│ ├── datepicker.png
├── introduction.md
├── post01.md
├── post02.md
├── snippets
│ ├── basic_frame.py
│ ├── basic_panel.py
└── wxpython_from_scratch.md
[EDIT]
It seems that the items in the menu-bar are created form a heading in the md file
## WxPython from Scratch
Github seems to pick up the first heading and place that in the menu-bar
Can someone please show me how to suppress these?
Dumped Jekyll in favour of Sphinx on Netlify
Using polymer-cli 1.7.7, bundling a Polymer 3 app for esm, es6 and es5 support does not output node_modules. As a consequence, dependencies such as #webcomponents/webcomponentsjs are not found when the bundles are served with prpl-server.
Here is a small example for reproduction:
https://github.com/lpellegr/polymer-bundler-bundle-issue
This example is based on the original polymer 3 app template generated by polymer-cli init. The configuration file polymer.json has been edited to generate esm, es6 and es5 bundles as suggested on the following resource:
https://polymer.github.io/pwa-starter-kit/building-and-deploying/
If you run polymer build, the output directory does not contain include a node_modules directory and thus not the JavaScript file for webcomponentjs:
build/
├── es5-bundled
│ ├── index.html
│ ├── push-manifest.json
│ ├── service-worker.js
│ └── src
│ └── _element
│ └── _element.js
├── es6-bundled
│ ├── index.html
│ ├── push-manifest.json
│ ├── service-worker.js
│ └── src
│ └── _element
│ └── _element.js
├── esm-bundled
│ ├── index.html
│ ├── push-manifest.json
│ ├── service-worker.js
│ └── src
│ └── _element
│ └── _element.js
└── polymer.json
If you remove the builds option from polymer.json (thus reverting to the default template), then all looks good, the right node_modules folder is outputted:
build/ └── default
├── index.html
├── node_modules
│ ├── #polymer
│ │ └── polymer
│ │ ├── lib
│ │ │ ├── elements
│ │ │ │ └── dom-module.js
│ │ │ ├── mixins
│ │ │ │ ├── element-mixin.js
│ │ │ │ ├── properties-changed.js
│ │ │ │ ├── properties-mixin.js
│ │ │ │ ├── property-accessors.js
│ │ │ │ ├── property-effects.js
│ │ │ │ └── template-stamp.js
│ │ │ └── utils
│ │ │ ├── async.js
│ │ │ ├── boot.js
│ │ │ ├── case-map.js
│ │ │ ├── html-tag.js
│ │ │ ├── mixin.js
│ │ │ ├── path.js
│ │ │ ├── resolve-url.js
│ │ │ ├── settings.js
│ │ │ └── style-gather.js
│ │ └── polymer-element.js
│ └── #webcomponents
│ └── webcomponentsjs
│ └── webcomponents-loader.js
└── src
├── _element
│ └── _element.js
└── test-app
└── test-app.js
Is there something wrong with my polymer.json? Is it a bug with polymer-bundler?
Your polymer.json file doesn't include the information that the Polymer CLI uses to decide what to include in the build.
Adding the missing lines as per the PWA Starter Kit makes it work, for example:
"entrypoint": "index.html",
"extraDependencies": [
"node_modules/#webcomponents/webcomponentsjs/**"
],
I am trying to put an image in html template in my django applicarion but its is not displayed. When i inspect, it says image cannot be loaded.
HTML code:
<div class = "col-md-4">
<img src= "/static/images/abc.jpg" alt="sorry"/>
</div>
location of the image abc.png is /home/user/demo/mysite/mysite/static/images/abc.png
and my django application is bookmark which resides in mysite(demo/mysite)
Is it the correct way of giving path in a django application or something else needs to be done.
.
└── mysite
├── bookmark
│ ├── admin.py
│ ├── admin.pyc
│ ├── apps.py
│ ├── forms.py
│ ├── forms.pyc
│ ├── __init__.py
│ ├── __init__.pyc
│ ├── migrations
│ │ ├── 0001_initial.py
│ │ ├── 0001_initial.pyc
│ │ ├── 0002_auto_20171029_1436.py
│ │ ├── 0002_auto_20171029_1436.pyc
│ │ ├── 0003_userbookmark.py
│ │ ├── 0003_userbookmark.pyc
│ │ ├── __init__.py
│ │ └── __init__.pyc
│ ├── models.py
│ ├── models.pyc
│ ├── static
│ │ └── style.css
│ ├── templates
│ │ ├── 20150225_134637.jpg
│ │ ├── abc.jpg
│ │ ├── base_generic.html
│ │ ├── category.html
│ │ ├── index.html
│ │ ├── login.html
│ │ ├── myprofile.html
│ │ ├── profile.html
│ │ ├── register2.html
│ │ ├── register.html
│ │ ├── registerInterest.html
│ │ ├── sample
│ │ └── success.html
│ ├── tests.py
│ ├── urls.py
│ ├── urls.pyc
│ ├── views.py
│ └── views.pyc
├── db.sqlite3
├── manage.py
├── mysite
│ ├── __init__.py
│ ├── __init__.pyc
│ ├── settings.py
│ ├── settings.pyc
│ ├── static
│ │ └── images
│ │ ├── abc.jpg
│ │ └── icons_core-88916797fd4fde57d4120dea4c239f1d#1x.png
│ ├── urls.py
│ ├── urls.pyc
│ ├── wsgi.py
│ └── wsgi.pyc
└── urls.py
I have edited the post and added the tree structure of my project
This is correct way to use static files in django templates
{% load static %}
<div class="col-md-4">
<img src= "{% static "images/abc.jpg" %} alt="sorry"/>
</div>
So I have a package.json that looks like this:
{
"name": "node-api",
"main": "server.js",
"dependencies": {
"express": "~4.0.0",
"mongoose": "~3.6.13",
"body-parser": "~1.0.1"
}
}
When I run "npm install" on Ubuntu I get a tree structure in node_modules that looks like this:
.
├── body-parser
│ ├── lib
│ │ └── types
│ └── node_modules
│ ├── bytes
│ ├── content-type
│ ├── debug
│ │ └── node_modules
│ ├── depd
│ │ └── lib
│ ├── http-errors
│ │ └── node_modules
│ ├── iconv-lite
│ │ ├── encodings
│ │ └── lib
│ ├── on-finished
│ │ └── node_modules
│ ├── qs
│ │ ├── dist
│ │ ├── lib
│ │ └── test
│ ├── raw-body
│ │ └── node_modules
│ └── type-is
│ └── node_modules
├── express
│ ├── lib
│ │ ├── middleware
│ │ └── router
│ └── node_modules
│ ├── accepts
│ │ └── node_modules
│ ├── array-flatten
│ ├── content-disposition
│ ├── content-type
│ ├── cookie
│ ├── cookie-signature
│ ├── debug
│ │ └── node_modules
│ ├── depd
│ │ └── lib
│ ├── escape-html
│ ├── etag
│ ├── finalhandler
│ │ └── node_modules
│ ├── fresh
│ ├── merge-descriptors
│ ├── methods
│ ├── on-finished
│ │ └── node_modules
│ ├── parseurl
│ ├── path-to-regexp
│ ├── proxy-addr
│ │ └── node_modules
│ ├── qs
│ │ ├── lib
│ │ └── test
│ ├── range-parser
│ ├── send
│ │ └── node_modules
│ ├── serve-static
│ ├── type-is
│ │ └── node_modules
│ ├── utils-merge
│ └── vary
└── mongoose
├── examples
│ ├── aggregate
│ ├── express
│ │ └── connection-sharing
│ ├── geospatial
│ ├── globalschemas
│ ├── lean
│ ├── mapreduce
│ ├── population
│ ├── promises
│ ├── querybuilder
│ ├── replicasets
│ ├── schema
│ │ └── storing-schemas-as-json
│ └── statics
├── lib
│ ├── drivers
│ │ ├── browser
│ │ └── node-mongodb-native
│ ├── error
│ ├── schema
│ ├── services
│ └── types
└── node_modules
├── async
│ └── lib
├── bson
│ ├── alternate_parsers
│ ├── browser_build
│ ├── lib
│ └── tools
├── hooks-fixed
├── kareem
│ └── test
├── mongodb
│ ├── lib
│ ├── node_modules
│ └── test_boot
├── mpath
│ ├── lib
│ └── test
├── mpromise
│ ├── lib
│ └── test
├── mquery
│ ├── lib
│ ├── node_modules
│ └── test
├── ms
├── muri
│ ├── lib
│ └── test
├── regexp-clone
│ └── test
└── sliced
├── lib
└── test
123 directories
I only am showing 4 levels deep of the directory tree but the top level are just the 3 "dependencies" in my packages.json. I like this because it keeps everything nice and organized.
Here is how it shows up on my Mac:
.
├── accepts
├── array-flatten
├── async
├── bluebird
├── body-parser
├── bson
├── bytes
├── content-disposition
├── content-type
├── cookie
├── cookie-signature
├── core-util-is
├── debug
├── depd
├── destroy
├── ee-first
├── es6-promise
├── escape-html
├── etag
├── express
├── finalhandler
├── forwarded
├── fresh
├── hooks-fixed
├── http-errors
├── iconv-lite
├── inherits
├── ipaddr.js
├── isarray
├── kareem
├── media-typer
├── merge-descriptors
├── methods
├── mime
├── mime-db
├── mime-types
├── mongodb
├── mongodb-core
├── mongoose
├── mpath
├── mpromise
├── mquery
├── ms
├── muri
├── negotiator
├── on-finished
├── parseurl
├── path-to-regexp
├── proxy-addr
├── qs
├── range-parser
├── raw-body
├── readable-stream
├── regexp-clone
├── send
├── serve-static
├── sliced
├── statuses
├── string_decoder
├── type-is
├── unpipe
├── utils-merge
└── vary
I personally hate that because you can't tell why a certain dependency is there if your project gets big, and it can get messy real fast.
Both computers are running npm 2.14.7 and node 4.2.2. Is there any way to make it store dependencies in the structure of the first tree that I showed?
I'm trying to create a set of project pages using Github Pages. My main page is a copy of my project's README, which I generated through Github's auto-page generator. Under Project Health Metrics, I link to two HTML reports: one is a CodeNarc report (at health/codenarc/main.html) and the other is a Jacoco report (at health/jacoco/index.html).
The CodeNarc report renders fine, but the Jacoco report doesn't as it's not able to load the stylesheet and other resources kept in another directory. I'm keeping everything on a gh-pages branch with a directory structure that looks like this:
.
├── Gemfile
├── Gemfile.lock
├── _config.yml
├── _site
├── bin
├── build
├── build.gradle
├── config
├── docs
├── gradle.properties
├── health
├── images
├── index.html
├── javascripts
├── params.json
├── src
└── stylesheets
My health directory tree appears like this:
health
├── codenarc
│ ├── integrationTest.html
│ ├── main.html
│ └── test.html
├── html
│ └── projectHealth.html
└── jacoco
├── .resources
│ ├── branchfc.gif
│ ├── branchnc.gif
│ ├── branchpc.gif
│ ├── bundle.gif
│ ├── class.gif
│ ├── down.gif
│ ├── greenbar.gif
│ ├── group.gif
│ ├── method.gif
│ ├── package.gif
│ ├── prettify.css
│ ├── prettify.js
│ ├── redbar.gif
│ ├── report.css
│ ├── report.gif
│ ├── session.gif
│ ├── sort.gif
│ ├── sort.js
│ ├── source.gif
│ └── up.gif
├── .sessions.html
├── com.github.tagc.semver
│ ├── SemVerPlugin$_apply_closure1.html
│ ├── SemVerPlugin.groovy.html
│ ├── SemVerPlugin.html
│ ├── SemVerPluginExtension.groovy.html
│ ├── SemVerPluginExtension.html
│ ├── Version$Builder.html
│ ├── Version$Category.html
│ ├── Version$Parser.html
│ ├── Version.groovy.html
│ ├── Version.html
│ ├── index.html
│ └── index.source.html
└── index.html
If it helps, you can explore the tree and check out all the files from my Github repository.
I would like the Jacoco report to be able to access the resources in the .resources folder under health/jacoco, but it doesn't seem able to and I'm not quite sure why. I've tried playing around with this a lot on a private instance running on localhost through Jekyll.
Problem solved, thanks to help from some people in IRC and a lot of playing around.
Jekyll ignores any folders that are hidden (e.g. prepended with a dot or underscore), so it wasn't processing health/jacoco/.resources.
I got around this issue by including include: ['.resources'] in _config.yml. Don't forget to push this file to the remote gh-pages branch on Github, as Github uses this to determine what it processes as well.
The Jacoco report now renders properly because it can access the stylesheets and other resources it depends on.