---
title: "Element <link>"
source: https://dev.pageseeder.com/psml/elements/element-link.html
description: "PSML Element reference for <link>"
last_updated: 2026-08-07T17:09:54+10:00
tokens: ~1340
---

# \<link\>

## Summary

The `<link>` element is used to represent a link to an external resource or to an anchor.

For links within PageSeeder, the appropriate element is `<xref>`.

## Usage context

| Element category | character-style |
| --- | --- |
| PSML level | portable |
| Permitted content | \<bold\> \<italic\> \<underline\> \<br\> \<sub\> \<sup\> \<anchor\> \<inline\> \<placeholder\> \<monospace\> and text |
| Permitted parent |  |
| HTML equivalent | `<a>` (but *NOT* `<link>` !) |
| OpenXML equivalent | `<w:hyperlink>` |

## Attributes

This element includes the following attributes

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `archived` | `boolean` | no | Whether the URL is archived |
| `frag` | `xs:string` | no | The fragment of the target |
| `href` | `xs:string` | yes | URL for link target |
| `labels` | [label-list](../datatypes/pageseeder_datatypes.md) | no | A list of xref labels |
| `mediatype` | `xs:string` | no | The media type of the target URL |
| `role` | [role](../datatypes/pageseeder_datatypes.md) | no | Custom value that can be used for formatting. **DEPRECATED.** |
| `uriid` | [xs:long](../datatypes/xml_schema_datatypes.md) | no | The URI ID of the target URL |
| `urltype` | [document-type](../datatypes/pageseeder_datatypes.md) | no | The target document’s type |
| `unresolved` | [boolean](../datatypes/pageseeder_datatypes.md) | no | If `true`, the target URL doesn't exist in PageSeeder |

### `@archived`

A boolean flag indicating whether the URL is archived. *INFORMATIONAL - ignored by upload.*

*This attribute was introduced in PSML v1.3 in PageSeeder 5.99.*

### `@frag`

The fragment for the target. *On upload this overrides the value after # on the `@href`.*

**This attribute was introduced in PSML 1.3 in PageSeeder 5.99.**

### `@href`

The URL to the external resource to link to.

### `@labels`

A comma-separated list of Link labels.

*This attribute was introduced in PSML 1.3 in PageSeeder 5.99.*

### `@mediatype`

The media type of the target URL. *INFORMATIONAL - ignored by upload.*

*This attribute was introduced in PSML 1.3 in PageSeeder 5.99.*

### `@role`

Custom value that can be used for formatting.

> **Deprecated:** This attribute was deprecated in PSML 1.3 in PageSeeder 5.99. Use `@labels` instead.

### `@uriid`

The [URI ID](../../reference/glossary/uri_id.md) of the target URL. *Ignored by upload if the PSML file came from a different PageSeeder server.*

**This attribute was introduced in PSML 1.3 in PageSeeder 5.99.**

### `@urltype`

The target [URL's type](../../guide/configuration/url_types.md). *INFORMATIONAL - ignored by upload.*

*This attribute was introduced in PSML 1.3 in PageSeeder 5.99.*

### `@unresolved`

If `true`, the target URL doesn’t exist in PageSeeder. *INFORMATIONAL - ignored by upload.*

*This attribute was introduced in PSML 1.3 in PageSeeder 5.99.*

## Examples

### Link to site 

A link to a Website:

```lang-xml

<link href="https://dev.pageseeder.com">PageSeeder for developers</link>
```

This is converted to the following HTML:

```lang-html

<a href="https://dev.pageseeder.com">PageSeeder for developers</a>
```

### Link with role

Links with roles:

```lang-xml

<link href="https://download.pageseeder.com/latest"
      role="download">Download PageSeeder</link>
```

The role could be used to convert to HTML as:

```lang-html

<a href="https://download.pageseeder.com/latest" 
   download class="button">Download PageSeeder</a>
```

### Link to anchor

An internal link pointing to an `<anchor>` element or a `<fragment>` element:

```lang-xml

<link href="#part-3">Skip to part 3<link>
```

## Schema

### XML Schema

```lang-xml

<xs:element   name="link">
  <xs:complexType mixed="true">  
    <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element ref="bold" />
        <xs:element ref="italic" />
        <xs:element ref="underline" />
        <xs:element ref="br" />
        <xs:element ref="sub" />
        <xs:element ref="sup" />
        <xs:element ref="anchor" />
        <xs:element ref="inline" />
        <xs:element ref="placeholder" />
        <xs:element ref="monospace" />
    </xs:choice>
    <xs:attribute name="archived"   type="xs:boolean"/>
    <xs:attribute name="href"       type="xs:string"
                  use="required"/>
    <xs:attribute name="role"       type="role"/>
    <xs:attribute name="uriid"      type="xs:long">
    <xs:attribute name="frag"       type="xs:string">
    <xs:attribute name="mediatype"  type="xs:string">
    <xs:attribute name="urltype"    type="document-type">
    <xs:attribute name="labels"     type="label-list">
    <xs:attribute name="unresolved" type="xs:boolean">
  </xs:complexType>
</xs:element>
```

### Relax Schema

```lang-relax

element link {
   attribute archived   { xs:boolean }?,
   attribute href       { text },
   attribute role       { role }?,
   attribute uriid      { xs:long }?,
   attribute frag       { text }?,
   attribute mediatype  { text }?,
   attribute urltype    { document-type }?,
   attribute labels     { label-list }?,
   attribute unresolved { xs:boolean }?,
   (bold | italic | underline | br | sub |
    sup | anchor | inline | placeholder | monospace)+
}
```

## Compatibility

This element was introduced in the first draft of PSML and is well-supported from PageSeeder 5.1.

