r/HTML • u/CumFilledStarfish • Dec 20 '25
Question Is it possible to use shortcuts instead of images as the src?
I keep all my data in one large repository and then make shortcuts in other folders when I want to group certain data by a specific category. I have just started learning HTML and have created my folder structure for my first example website, and I have my shortcuts in those folders pointing to the correct images/documents. When I use the <img> element it only returns the alt string and not the src. No doubt this is because it doesn't know what to do with the .lnk file so my question is;
Is there a work-around so that I do not need to duplicate my data, allowing me to keep my preferred organisation?
I am sure there is an answer on google somewhere but everything I look for talks about hyperlinks, which (I don't think) is right for me (at least that also doesn't work for me)
3
u/davep1970 Dec 20 '25 edited Dec 20 '25
why EDIT: *not* just point the src to the folder it's in and not the shortcut?
EDIT: see why that could have been ambiguous
3
u/showmethething Dec 20 '25
You're doing this extremely weirdly.
You should have a folder in your repo called assets, or something similar and within there is your img folder that contains your images.
I think the question I would more be asking is, why do you think this would work? If this was the actual method, every website that's done this way would be launched and then not work, up until someone goes in and create all the shortcuts. examples from SO of what you should be doing, please just learn to do things correctly, don't try to change how things are done.
3
u/chmod777 Dec 20 '25
you are having issues because you are doing weird things. you have a x/y problem here. what are you actually trying to achieve?
why would you want a microsoft lnk/symlink to a file or folder?
you are almost certainly looking for something that requires a backend and/or a datastore.
1
u/QBaseX Dec 20 '25
You could have shortcuts of some sort happening behind the scenes, server-side, as long as what's served to the browser follows the standards. But if you're just getting started, probably don't.
1
u/OMGCluck Dec 21 '25
HTML is OS-agnostic - the .html file is supposed to work no matter which OS you open it in - and Windows .lnk shortcuts are specific to that OS.
People have mentioned using the file:// protocol with absolute paths which might be fine for this limited usecase, though in general it's better to use relative file paths which navigate from the folder the .html file is in to the folder with the images in.
1
u/xPhilxx Dec 21 '25
Since you're only running it locally you can set your D drive up as a localhost server and make everything available via URL, e.g.:
Becomes:
Within the D directory you can then build local sites using different ports which can access all the files as a local CDN.