Module
Contents
Index 🔎︎

# Ligazóns relativas e absolutas

Debe ter en conta dous factores ao incluír hiperligazóns: se están definidas como relativas ou absolutas e se o ficheiro está presente ou non.

- Choose LibreOffice - PreferencesTools - Options
  - Load/Save - General and specify in the Save URLs relative to field if LibreOffice creates relative or absolute hyperlinks. Relative linking is only possible when the document you are working on and the link destination are on the same drive.

- 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.

- A link to a web page, for example, "www.example.com" or "www.myprovider.com/mypage/index.html" is an absolute link.

- LibreOffice reacciona de forma diferente dependendo de se o ficheiro referido pola ligazón existe ou non e segundo onde estea localizado. LibreOffice comproba as novas ligazóns e define automaticamente un destino e un protocolo. O resultado pode verse no código HTML xerado tras gardar o documento fonte.

- Aplícanse as seguintes regras: As referencias relativas ("imaxe/imaxe.gif") só son válidas cando ambos os ficheiros se sitúan na mesma unidade. Se os ficheiros se encontran en unidades diferentes do sistema, a referencia absoluta será o protocolo "file:" ("file:///data1/xyz/imaxe.gif"). Se se encontran en servidores diferentes ou se o destino da ligazón non está dispoñíbel, a referencia absoluta utilizará o protocolo "http:" ("http://data2/abc/imaxe.gif").

- Organice todos os ficheiros da súa páxina principal na mesma unidade que o seu ficheiro de inicio. Desta forma, LibreOffice pode definir o protocolo e o destino para que a referencia no servidor sexa sempre correcta.

Cando posiciona o rato nunha hiperligazón, unha suxestión de axuda mostra a referencia absoluta, xa que LibreOffice utiliza internamente nomes de camiños absolutos. O camiño e enderezo completo mostraranse só ao ver o resultado da exportación HTML, cargando o ficheiro HTML como "texto" ou abríndoo cun editor de texto.

Temas relacionados

Editar hiperligazóns