Skip to content

Commit f9a4333

Browse files
committed
Document special path patterns and managed link behavior
1 parent 4e76f55 commit f9a4333

File tree

1 file changed

+41
-2
lines changed

1 file changed

+41
-2
lines changed

README.md

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,43 @@ The config file supports YAML streams (multiple documents separated by `---`). E
119119
| `title` | string | No | Link title for organization |
120120
| `tags` | string[] | No | Tags for categorization |
121121

122+
### Special Path Patterns
123+
124+
Short.io supports special path patterns for advanced routing:
125+
126+
| Pattern | Description | Example |
127+
|---------|-------------|---------|
128+
| `""` (empty) | Root domain redirect | `short.io` → `https://example.com` |
129+
| `*` | Catch-all for 404s | `short.io/anything` → `https://example.com/not-found` |
130+
| `path/*` | Path prefix with capture | `short.io/docs/intro` → `https://example.com/docs/intro` |
131+
132+
In path prefix patterns, use `$1` in the destination URL to insert the captured path segment.
133+
134+
```yaml
135+
domain: "short.example.com"
136+
137+
links:
138+
# Root redirect - visitors to short.example.com go to main site
139+
"":
140+
url: "https://www.example.com"
141+
title: "Root redirect"
142+
143+
# 404 catch-all - any unmatched path redirects to help page
144+
"*":
145+
url: "https://www.example.com/help"
146+
title: "404 fallback"
147+
148+
# Path prefix - short.example.com/docs/anything → docs.example.com/anything
149+
"docs/*":
150+
url: "https://docs.example.com/$1"
151+
title: "Docs passthrough"
152+
153+
# Another example - short.example.com/gh/repo/path → github.com/myorg/repo/path
154+
"gh/*":
155+
url: "https://github.com/myorg/$1"
156+
title: "GitHub shortcut"
157+
```
158+
122159
## Examples
123160

124161
### Dry-run mode
@@ -161,11 +198,13 @@ Access the sync results in subsequent steps:
161198

162199
## Sync Behavior
163200

164-
The action performs a **full sync** between your YAML config and Short.io:
201+
The action performs a **declarative sync** between your YAML config and Short.io:
165202

166203
1. **Create** - Links in YAML but not in Short.io are created
167204
2. **Update** - Links where URL, title, or tags differ are updated
168-
3. **Delete** - Links in Short.io but not in YAML are deleted
205+
3. **Delete** - Links removed from YAML are deleted (only if previously managed by this action)
206+
207+
Links created by the action are tagged with `github-action-managed`. This ensures that manually created links in Short.io are never deleted—only links that were originally created through this action will be removed when deleted from the YAML config.
169208

170209
Links are identified by the combination of `domain` and `slug`. Changing a slug will result in the old link being deleted and a new one created.
171210

0 commit comments

Comments
 (0)