Replies: 3 comments 5 replies
-
Using the full canonical URLs for all links is an interesting idea, but in practice I think there are probably reasons to have internal links start with It's worth researching a little more to see if there are more pros and cons there. My gut feeling is that it should probably be up to the user to be able to opt in to using internal or external (full) URLs. It can't think of any specific issues it would cause, but it does seem unconventional so I could imagine there might be some. |
Beta Was this translation helpful? Give feedback.
-
Some notes from our discussion today: Get link to assetExample: link to an image resource.
Pages.linkToAsset [ "images", "hero.png" ]
Pages.linkToPublicAsset [ "images", "hero.png" ]
Have a URL that points to a pageRoute.toString <| Route.Blog__Slug { slug = "my-post" } Route.toPath <| Route.Blog__Slug { slug = "my-post" }
Route.Blog__Slug { slug = "my-post" }
|> Route.toPath
|> Pages.toAbsolute Get the path for the current pageExample: check if navbar link is a prefix of current path (you're on Two helpers for with or without base
|
Beta Was this translation helpful? Give feedback.
-
The longer I think about, the more I value a centralized The goal: Anything that lives on your site can be pointed to by a Constructing
|
Beta Was this translation helpful? Give feedback.
-
While working on the alternative to #230 I was trying to figure out all the places where the base needs to be prepended. I was looking at the canonical URL and I am now thinking that since we have to provide the canonical URL anyway, we might be able to get rid of the base.
My hunch is that maybe we can replace the CLI optional parameter
--base
with a--canonical
and make all absolute URLs fully qualified. For example, I would deploy withelm-pages build --canonical https://y0hy0h.github.io/unnecessarily-bad-design/
and all the links would look likehttps://y0hy0h.github.io/unnecessarily-bad-design/radiator-valves
instead of/unnecessarily-bad-design/radiator-valves
.The main advantage is that we can rid of the finicky base path concept and simply embed it into the existing canonical URL concept. Also, it feels easier to decide on the canonical when I deploy rather then while I'm building the site, therefore moving the canonical out of the code and into a deploy parameter seems cleaner to me.
This also makes it easier to have fully qualified URLs for the dev server, since we could use
localhost
as the default canonical, if none is supplied.What are your thoughts on this?
Beta Was this translation helpful? Give feedback.
All reactions