What does "./" do in href? - html

I know that for example:
../path/to/file.html
does first jump from the current directory to the next higher directory and then enters
path/to/file.html
However what does
./path/to/file.html
do? I couldn't find an answer on the net so far :(

./ or . is ALWAYS the current directory.
~/(on Linux) is the current user's home directory.
For you to know as well: cd %userprofile% (on Windows) sends you to home user directory
Imagine I you're in repository2 and you want to include the file.txt:
~/ ---> Pictures
---> Documents --> repository1 --> repository2
---> Downloads
---> file.txt
You simply do:
../../file.txt
or
~/file.txt
And Imagine you want to move the file.txt to the current repository:
mv ../../file.txt .

. is a reference to the current directory. See: Path (computing)

Related

./ and ../ directory differences

I know this question will get so many downvotes and will be marked as a duplicate.
The problem is I searched a lot about that question and never got a satisfying answer.
When working with sources in HTML and we want to get an image from the same folder of the HTML file we type the image name directly. If it's inside a folder which is in the same place as the HTML file is, we type the folder name then image, and so on....
If the image is in a folder which contains another folder in which the HTML file exists, so we want to get one step back. We type ../ which means go one step back then the image name.
When I started learning node and how to use modules, modules which were in the same folder as the node file is, must be imported using ./ which was explained as 'in the same folder', while when we import modules like 'fs' and 'events' they don't need a ./
Can someone explain why we don't use ./ in html files while they are used sometimes in node and sometimes no?!
I want to explain it because the node default import setting.
like 'fs' and 'events', these library was installed with node installed, and was included by default. And these will be stored in system directory. Just like <stdio.h> for c, fs from python. It's the default library for the corresponding language.
But sometimes you write you own libraries wanted to be import by other node file, you should import it by using relative path...Because if you don't write './', it will default search the system file directory where is stored 'fs', 'http' and so on, node will not find your libraries.
Before we start ./ and ../ notation is used to refer files relatively.
Why we sometimes don't use ./ in node?
All the modules we install in NodeJS are in the folder node modules. Whenever you require a module require('fs') or require('3rdparty'). Node exactly knows where to look for the module as it is installed as a folder in local node_modules or global node_modules. And then it loads the index.js and then so on..
When to use ./ in node?
./ is a way(Relative way) to refer files in the file system. If you have a script which is part of the file system and not as part of a node_module, then you use './' or '../' notation based on your file location
Why we don't use ./ in HTML files?
As said by #sami, you can use either ./ or not. It works in both ways. I am accustomed to ./ when I work. It's more of personal opinion.
Hope this helps.

How to install ESP32 support into Arduino IDE?

Here the link to the page that tells me how to give Arduino the capability to create sketches for my ESP board:
https://github.com/espressif/arduino-esp32/blob/master/docs/arduino-ide/windows.md
open a Git Bash session pointing to ARDUINO_SKETCHBOOK_DIR and execute git submodule update --init --recursive
I have identified the ARDUINO_SKETCHBOOK_DIR from the Arduino IDE. So I do have a path that points from the C:\ drive to this directory. What fails is when I do open GIT Bash and change current directory to the one I have defined as being the ARDUINO_SKETCHBOOK_DIR and do enter the command as shown GIT bash complains "No such file or directory". Effectively this directory is still empty.
Just for completeness of my question. I have followed the instruction on the page whose link I gave to this point where I do no know how to get ahead!
You need to change slashes form "\" to "/" and "C:\" to "c/", and put it in double quotes. Like:
cd "/c/Program Files (x86)/Arduino/hardware/espressif/esp32"

How to use logic path in web site

I have a website:
www.mydomain.com/panel/abcde.html
I don't remember the difference between ./ and ../
./ is used to return in the first level?
Instead ../ is used to simulate all domain?
.../ exists?
I believe it is like this :
/ = root of the currently location
./ = current directory
../ = parent of current directory
Reference could be found here
/ is the root folder of the filesystem.
./ usually denotes the current folder that your program or script is in, usually the same one with the file you run.
../ denotes the folder above the current one.
.../ Does not exist. If you type that on terminal, it will throw error No such file or directory

Html relative paths using period

I'm confused as to when the following are used and what they mean, for example in the src attribute of an img tag.
I know / means 'current directory' and ../ means 'up one directory'
. Current Directory? &lta href="." /&gt
./ Current Directory &ltimg src="./image.png" /&gt
/ Root directory &ltimg src="/image.png" /&gt
../ Up one directory &ltimg src="../image.png" /&gt
What is the difference between ./image.png and /image.png
Updated: / means root directory of the site
/ means starting from the root directory. Whereas ./ is the current directory, though I'm not sure there's any need for it (unless you're planning on appending to a PATH in Linux systems... happy to be wrong about that one).
./image.png will grab image.png relative to your current location. Calling ./image.png on domain.tld/site/page.html will look for the image at domain.tld/site/image.png
/image.png will look for the image in the root of your site. domain.tld/image.png
You could also use things like ../images/image.png. If this was used on domain.tld/site/page.html, the browser would load the image from domain.tld/images/image.png
The / means the root directory. Use . For the current directory.

How can I setup Jekyll for a blog with a large image directory, so as to avoid duplicating that directory in the generated site?

I'm considering Jekyll for a site I'm putting together that will be a blog with lots of images (and other larg-ish media files). It's easy enough to to make a directory for images and then link to them as needed in the posts. But, as I understand it, when the site is generated, all the image data will be duplicated into the generated _site directory that holds the static files. Each time the site is generated the _site directory is emptied, and repopulated with the static version of the site.
Is there any way to, for example, drop a symlink to the images directory inside the site directory, and then maybe have jekyll ignore it when the static files are generated?
Or is there another way to go about this that makes more sense?
Assuming you are running on an apache web server, you can setup an Alias directive to serve images from a directory outside of the normal docroot. You need access to edit the VirtualHosts config or some other ability to create aliases directives (e.g. via a control panel).
For an example of how this would work, let's say you are storing your jekyll files under a directory called "/web/jekyll". To get your images directory do the following:
Add an "_images" directory along with your basic jekyll tree. Ending up with something like:
_config.yml
_images/
_layouts/
_posts/
_site/
index.md
Update your apache config to add the Alias directive like:
Alias /images /web/jekyll/_images
Reload the apache config and run jekyll to build the site.
Since the image directory name starts with an underscore, jekyll won't push/copy it to the output _site during the build. Apache will happily serve most files from your _site directory as normal, but when it sees something like "http://jekyll/images/test.jpg", instead of looking for the file under "/web/jekyll/_site/_images/test.jpg", it'll serve it from "/web/jekyll/_images/test.jpg".
Incidentally, I like a little more separation of the source content and output content than jekyll defaults to. So, I setup my directory structure as follows:
/web/jekyll/html/
/web/jekyll/images/
/web/jekyll/source/
/web/jekyll/source/_config.yml
/web/jekyll/source/_layouts
/web/jekyll/source/_posts
/web/jekyll/source/index.md
With the following option set in _config.yml
destination: ../html
And the apache alias directive setup with:
Alias /images /web/jekyll/images
Jekyll is run in the "/web/jekyll/source" directory, but output is sent to the "/web/jekyll/html" dir. Similar to the first example, calls to "http://jekyll/images/test.jpg" are served from "/web/jekyll/images/test.jpg". This setup doesn't really make a difference from a site serving perspective. I just like the cleaner separation between the raw source files, the fully baked output files and the images which work via the alias.
Correct, the first part of the jekyll command removes everything in the destination directory. The problem with that is the symlinks must be manually created again. So next, go ahead and create a script that does this each time.
Be sure that:
exclude: [jekyll, css, img] in the _config.yml file
linux: The ";" symbol runs first, second, third.. commands.
script: A file named jekyll with executable permissions containing
jekyll;
ln -s /var/www/css /var/www/_site/css;
ln -s /var/www/img /var/www/_site/img;
Finally run (./jekyll) that program instead of jekyll.
-Dan
Make a project page for the images.
Set up directory structure
/home/git/svnpenn.github.io
/home/git/img
Run Jekyll
# We cant add the symlink until after jekyll is done. We will remove the
# site folder and wait for it to rebuild.
rm -r _site
jekyll --server &
while [ ! -f _site/index.html ]
do
sleep 1
done
ln -s ../images _site/images
Note I was using this because I thought it would help publish time on GitHub
pages. It does not. GitHub can take 1-10 minutes to publish depending on the
server.
I know this has already been answered, but I went a slightly different route. I hosted all of my images in a public directory on Dropbox and use grunt to generate a manifest of the images. It keeps my repository small because the images don't get checked in. I detailed it a while back in a blog post.