This library is no longer in usage.
Either inline or create links in HTML. https://design-system.service.gov.uk/styles/typography/#links
Micro-library for building URLs from templates and tags.
- Creates links with settings that are appropriate to the target. See Link's companion object:
Links.toInternalPage // No SSO, Same Window
Links.toExternalPage // No SSO, New Window
Links.toPortalPage // Client-based SSO, Same Window
Links.toInternalPageWithSso // Server-based SSO, Same Window
- Constructs parametrized urls based on the tags and corresponding values provided.
Link
can be used in scala html templates to generate consistent links across a page:
@import uk.gov.hmrc.urls.Link
<li>
@{Link.toPortalPage(id = Some("link-id"),
url = "http://someserver:8080/something",
value = Some("Placeholder text displayed for the link")).toHtml}
</li>
UrlBuilder
can be used to build a URL based on parameters from a (tag, value) map:
UrlBuilder.buildUrl("http://server:8080/something/<tag1>/<tag2>",
Seq("<tag1>"->Some("value1"), "<tag2>"->Some("value2"))
)
would produce the url: http://someserver:8080/something/value1/value2
Include the following dependency in your SBT build
resolvers += "HMRC-open-artefacts-maven2" at "https://open.artefacts.tax.service.gov.uk/maven2"
libraryDependencies += "uk.gov.hmrc" %% "url-builder" % "x.x.x-play-yy"
Note, from version 3.6.0
, only Play 2.8 is supported.
Format:
sbt fmt
Then run the tests and coverage report:
sbt clean coverage test coverageReport
If your build fails due to poor test coverage, DO NOT lower the test coverage threshold, instead inspect the generated report located here on your local repo: /target/scala-2.12/scoverage-report/index.html
This code is open source software licensed under the Apache 2.0 License.