Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify <head> #92

Closed
s0kil opened this issue Sep 11, 2018 · 4 comments
Closed

Modify <head> #92

s0kil opened this issue Sep 11, 2018 · 4 comments

Comments

@s0kil
Copy link
Contributor

s0kil commented Sep 11, 2018

Currently, there is no way to dynamically modify <head> elements of a page, such as a title, and resource links.

Here is a simple way that this could be done, similar to: https://svelte.technology/guide#svelte-head

  fun render : Html {
    <head>
      <link rel="dns-prefetch" href="https://cdn.varvy.com">
    <head>

    <div>
      <{ "Hello" }>
    </div>
  }
@gdotdesign
Copy link
Member

It can be modified by using the application.head field in the mint.json, when used it can point to an Html file which is inserted into the head of the resulting document.

You can see an example in this repository: https://github.com/mint-lang/example-todo

@s0kil
Copy link
Contributor Author

s0kil commented Sep 12, 2018

It won't be dynamic, to update the title on every page change.

@gdotdesign
Copy link
Member

You can create a React Portal if you want that exact behavior: https://github.com/mint-lang/mint-core/blob/master/source/Html.Portals.Body.mint (but just for the head)

If you just want to set the title you can do it with Window.setTitle() https://github.com/mint-lang/mint-core/blob/master/source/Window.mint#L18

@gdotdesign
Copy link
Member

Closing because there is no activity for a while and there are solutions which are working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants