]> Lady’s Gitweb - x_status_git/blobdiff - Caddyfile
Support lookup by identifier
[x_status_git] / Caddyfile
index b4bcbffd690cfa6c9a8d86d7900d88eca6168fbb..a430aae06c9d8691e330c11e48c60b98528645ba 100644 (file)
--- a/Caddyfile
+++ b/Caddyfile
@@ -9,18 +9,44 @@ status.site.example {
                path_regexp jsonld \.jsonld$
        }
 
+       @atom {
+               path_regexp atom \.atom$
+       }
+
        @bare {
                not path_regexp /$
                not path_regexp \.jsonld$
+               not path_regexp \.atom$
        }
 
        @empty {
                expression {re.matcher.suffix} == ""
        }
 
+       handle / {
+               rewrite * /index.html
+               header Link </about.jsonld>;rel=meta;type="application/ld+json"
+               header Link </statuses.atom>;rel=alternate;type="application/atom+xml"
+       }
+
+       @iri {
+               path_regexp matcher ^/(?P<iri>[^/:]+:[^/]+)/?$
+       }
+
+       handle @iri {
+               handle @bare {
+                       rewrite * /.lookup.xhtml
+               }
+
+               handle @slash {
+                       redir * /{re.matcher.iri}
+               }
+       }
+
        handle /about {
                rewrite * /.about.html
                header Link </about.jsonld>;rel=meta;type="application/ld+json"
+               header Link </statuses.atom>;rel=alternate;type="application/atom+xml"
        }
 
        redir /about/ /about
@@ -30,53 +56,50 @@ status.site.example {
        handle /statuses {
                rewrite * /.statuses.html
                header Link </statuses.jsonld>;rel=meta;type="application/ld+json"
+               header Link </statuses.atom>;rel=alternate;type="application/atom+xml"
        }
 
-       @statusroot {
-               path_regexp matcher ^/statuses/(?P<path>.*)
-               not path_regexp ^/statuses/index\.
-       }
-
-       handle @statusroot {
-               handle /statuses/ {
-                       redir * /statuses
-               }
-
-               handle {
-                       redir * /{re.matcher.path}
-               }
-       }
+       redir /statuses/ /statuses
 
        rewrite /statuses.jsonld /statuses/index.jsonld
 
+       rewrite /statuses.atom /statuses/index.atom
+
        @dated {
-               path_regexp matcher ^/(?P<ym>\d{4}-\d{2})(?P<suffix>/[^/.]+)?(?:\..*|/)?$
+               path_regexp matcher ^/statuses/(?P<ym>\d{4}-\d{2})(?P<suffix>/[^/.]+)?(?:\..*|/)?$
+               not path_regexp ^/statuses/index[/.]?
        }
 
        handle @dated {
                handle @empty {
                        handle @bare {
                                rewrite * /.topic.html
-                               header Link </{re.matcher.ym}.jsonld>;rel=meta;type="application/ld+json"
+                               header Link </statuses/{re.matcher.ym}.jsonld>;rel=meta;type="application/ld+json"
+                               header Link </statuses.atom>;rel=alternate;type="application/atom+xml"
                        }
 
                        handle @slash {
-                               redir * /{re.matcher.ym}
+                               redir * /statuses/{re.matcher.ym}
                        }
 
                        handle @jsonld {
-                               rewrite * /{re.matcher.ym}/index.jsonld
+                               rewrite * /statuses/{re.matcher.ym}/index.jsonld
+                       }
+
+                       handle @atom {
+                               rewrite * /statuses/{re.matcher.ym}/index.atom
                        }
                }
 
                handle {
                        handle @bare {
                                rewrite * /.status.html
-                               header Link </{re.matcher.ym}.jsonld>;rel=meta;type="application/ld+json"
+                               header Link </statuses/{re.matcher.ym}.jsonld>;rel=meta;type="application/ld+json"
+                               header Link </statuses.atom>;rel=alternate;type="application/atom+xml"
                        }
 
                        handle @slash {
-                               redir * /{re.matcher.ym}{re.matcher.suffix}
+                               redir * /statuses/{re.matcher.ym}{re.matcher.suffix}
                        }
                }
        }
@@ -91,7 +114,7 @@ status.site.example {
        rewrite /topics.jsonld /topics/index.jsonld
 
        @topics {
-               path_regexp matcher ^/(?:topics/(?P<topic>[0-9A-Za-z_-]+))(?P<suffix>/[^/.]+)?(?:\..*|/)?$
+               path_regexp matcher ^/topics/(?P<topic>[0-9A-Za-z_-]+)(?P<suffix>/[^/.]+)?(?:\..*|/)?$
                not path_regexp ^/topics/index[/.]?
        }
 
@@ -100,6 +123,7 @@ status.site.example {
                        handle @bare {
                                rewrite * /.topic.html
                                header Link </topics/{re.matcher.topic}.jsonld>;rel=meta;type="application/ld+json"
+                               header Link </topics/{re.matcher.topic}.atom>;rel=alternate;type="application/atom+xml"
                        }
 
                        handle @slash {
@@ -109,12 +133,17 @@ status.site.example {
                        handle @jsonld {
                                rewrite * /topics/{re.matcher.topic}/index.jsonld
                        }
+
+                       handle @atom {
+                               rewrite * /topics/{re.matcher.topic}/index.atom
+                       }
                }
 
                handle {
                        handle @bare {
                                rewrite * /.status.html
                                header Link </topics/{re.matcher.topic}.jsonld>;rel=meta;type="application/ld+json"
+                               header Link </topics/{re.matcher.topic}.atom>;rel=alternate;type="application/atom+xml"
                        }
 
                        handle @slash {
This page took 0.025909 seconds and 4 git commands to generate.