- avoid using odd capitalization of URLs
- /This/IS/not/s3o-{frI3ndLy}
- Avoid having deep nesting of subdirectories like ".../dir1/dir2/dir3/dir4/dir5/dir6/page.html"
- Allow for the possibility of a part of the URL being removed
⇒ Proof of concept using dependent types in Idris
@GetMapping("/sports/basketball")
public ModelMap basketballHandler() {
...
}
GET /sports/basketball SportsController.basketballHandler
Routes (
GET Root homepageHandler &
GET (Root / Literal "sports") sportsHandler &
GET (Root / Literal "sports" / Literal "basketball") basketballHandler
)
Compiles
Does not compile
Follows SEO rules?
Breaks SEO rules?
Routes (
GET Root homepageHandler &
GET (Root / Literal "sports") sportsHandler &
GET (Root / Literal "sports" / Literal "basketball") basketballHandler
)
data Option : (t:Type) -> Type where
Some : (value:t) -> Option t
None : Option t
add : Int -> Int -> Int
add x y = x + y
*intro> Some 5
Some 5 : Option Integer
data List : (elem : Type) -> Type where
data Vect : (len : Nat) -> (elem : Type) -> Type where
Idris> [1,2,3]
[1, 2, 3] : List Int
Idris> the (Vect _ Int) [1,2,3]
[1, 2, 3] : Vect 3 Int
StringOrNat : Nat -> Type
StringOrNat Z = String
StringOrNat (S n) = Nat
divide : (x:Nat) -> (y:Nat) -> StringOrNat y
divide x Z = "Divisor was 0"
divide x y @ (S n) = div x y
Idris> divide 10 2
5 : Nat
Idris> divide 10 0
"Divisor was 0" : String
- avoid using odd capitalization of URLs
- /This/IS/not/s3o-{frI3ndLy}
Root / Literal "seo-friendly"
Root / Literal "{no_~.-$Eo-fRiEndLy}^"
Should compile
Should not
compile
- Avoid having deep nesting of subdirectories like ".../dir1/dir2/dir3/dir4/dir5/dir6/page.html"
Root / Literal "category" / Literal "sports" / Literal "football"
Root / Literal "category" / Literal "sports" / Literal "ball" / Literal "round" / Literal "foot"
Should compile
Should not compile
- Allow for the possibility of a part of the URL being removed
GET Root homepageHandler
GET Root / Literal "sports" sportsHandler
GET Root / Literal "sports" / Literal "football" footballHandler
Should compile
Should not compile
GET Root homepageHandler
GET Root / Literal "sports" / Literal "football" footballHandler
compile-time correspondance
curry data dependent function hole howard idris
implicit isomorphism lambda logic monad php proof rankingroutes search seo static types
{slides,github}.com/janschultecom/typelevel-seo
@janschultecom
- URLs with words that are relevant to your site's content and structure are friendlier for visitors navigating your site.
Root / Literal "has-football-keyword"
Root / Literal "eyjafjallajokull"
Should compile
Should not
compile
Root / Literal "has-no-keyword"
Should not
compile
Root / Literal "basketball"
Should compile