hotosm / learnosm

LearnOSM.org content, Jekyll layouts & issue tracking. This repository is dedicated to helping people learn how to map in OpenStreetMap (OSM) and use many of the software and tools in the OSM community.
http://learnosm.org
MIT License
247 stars 189 forks source link

Convert absolute links into relative ones #531

Closed Andygol closed 7 years ago

Andygol commented 7 years ago

While I was working on the transfer of the current site code to my own repository - https://andygol.github.io/learnosm/, I was faced with the problem of having absolute links for images, files and other pages in the page code. I had pages without images and with not working links.

[English](/en/beginner/id-editor)

I converted them into relative links for this purposes

[English]({{site.baseurl}}/en/beginner/id-editor)

❓❓❓ Does it make sense to have links for all internal resources as relative ones in the production code?

Nick-Tallguy commented 7 years ago

Hi, using my phone so just a short answer at the moment. This may be more to do with the format in the individual module. Some have a tab space at the beginning of the line and jekyll doesn't like it.

! [Image]  

For example might fail

Nick-Tallguy commented 7 years ago

Hi @Andygol on my laptop now so a better answer.

For example - https://andygol.github.io/learnosm/fa/beginner/start-osm/ is only displaying the first image, but you have inserted

    {{site.baseurl}}  

in front of all of the image links.

If you look at the module in the raw format - https://raw.githubusercontent.com/Andygol/learnosm/gh-pages/_posts/fa/0200-12-27-start-osm_fa.md you will see that the links in the text are; first image ![website][] is at the extreme left site of the 'page', whereas all of the other images are one tab or about 4 spaces from the left edge of the page.

On the main site http://learnosm.org/fa/beginner/start-osm/ I've removed the tab spaces and the images display.

We haven't needed the {{site.baseurl}} part of the address for at least a couple of years, although there are some modules that need updating.

I've been very gradually going through modules that are out of date, or need re formating, and removing unnecessary line feeds, tab spaces and other problems - but there is a way to go!

Regards

Nick p.s. just a thought, if this is not the full reason, the other may be where you are running the site once level up from root - but I don't think so.

Andygol commented 7 years ago

Hm, this is really weird behaviour when the leading space causes image breakage.

😞

I removed spaces before ![image][] links in my instance and now all looks well.

Nick-Tallguy commented 7 years ago

Ok to close now?

Nick-Tallguy commented 7 years ago

Closing on current info.