Relativa och absoluta lÀnkar
NÀr du inkluderar hyperlÀnkar mÄste du ta hÀnsyn till tvÄ faktorer: om du ska spara lÀnken som absolut eller relativ och om filen som du lÀnkat till finns eller inte.
-
VĂ€lj LibreOffice â InstĂ€llningarVerktyg â Alternativ â LĂ€s in/spara â AllmĂ€nt och ange i fĂ€ltet Spara URL:er relativt om LibreOffice ska skapa relativa eller absoluta hyperlĂ€nkar. Relativa lĂ€nkar kan bara anvĂ€ndas om det dokument du arbetar med finns pĂ„ samma enhet som lĂ€nkens mĂ„l.
-
You should create the same directory structure on your hard disk as that which exists in the web space hosted by your Internet provider. Call the root directory for the homepage on your hard disk "homepage", for example. The start file is then "index.html", the full path being "C:\homepage\index.html" (assuming Windows operating system). The URL on your Internet provider's server might then be as follows: "http://www.myprovider.com/mypage/index.html". With relative addressing, you indicate the link relative to the location of the output document. For example, if you placed all the graphics for your homepage in a subfolder called "C:\homepage\images", you would need to give the following path to access the graphic "picture.gif": "images\picture.gif". This is the relative path, starting from the location of the file "index.html". On the provider's server, you would place the picture in the folder "mypage/images". When you transfer the document "index.html" to the provider's server through the File - Save As dialog, and if you have marked the option Copy local images to Internet under LibreOffice - PreferencesTools - Options - Load/Save - HTML Compatibility, LibreOffice will automatically copy the graphic to the correct directory on the server.
-
An absolute path such as "C:\homepage\graphics\picture.gif" would no longer function on the provider server. Neither a server nor the computer of a reader needs to have a C hard drive: operating systems such as Unix or macOS do not recognize drive letters, and even if the folder homepage\graphics existed, your picture would not be available. It is better to use relative addressing for file links.
-
En lÀnk till en webbsida, t.ex. www.exempel.com eller www.minleverantör.com/minsida/index.html" Àr en absolut lÀnk.
-
LibreOffice reagerar ocksÄ pÄ olika sÀtt beroende pÄ om filen som lÀnken hÀnvisar till finns och var den finns. LibreOffice kontrollerar varje ny lÀnk och anger mÄl och protokoll automatiskt. Resultatet reflekteras i den HTML-kod som genereras nÀr kÀlldokumentet sparas.
-
Följande regler gÀller: En relativ adressering ("grafik/bild.gif") Àr bara möjlig om bÄda filerna finns pÄ samma enhet. Om bÄda filerna finns pÄ olika enheter, men i lokala filsystem, sker en absolut adressering med "file:"-protokoll ("file:///data1/xyz/bild.gif"). Om bÄda filerna finns pÄ olika servrar eller om mÄlet för lÀnken inte finns för nÀrvarande, sker en absolut adressering med "http:"-protokoll ("http://data2/abc/bild.gif").
-
Se till att du organiserar alla filer som du anvÀnder för hemsidan pÄ samma enhet som hemsidans startfil. Om du gör det kan LibreOffice ange mÄl och protokoll sÄ att referenserna pÄ servern alltid stÀmmer.
I tipshjÀlpen till en hyperlÀnk och i HTML-kÀlltextsredigeraren ser du alltid det absoluta skrivsÀttet eftersom LibreOffice alltid arbetar med absoluta sökvÀgar internt. Vad som skrivs i filen vid HTML-export ser du först nÀr du tittar pÄ resultatet av HTML-exporten, t.ex. genom att du laddar den skapade HTML-filen som "Text" eller öppnar den med en textredigeraren.