-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1271 from windymelt/introduce-ogp
Show meta tag for Open Graph Protocol
- Loading branch information
Showing
8 changed files
with
57 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
version = "3.7.9" | ||
version = "3.7.14" | ||
runner.dialect = scala213source3 | ||
maxColumn = 120 | ||
align.preset = some | ||
|
Binary file not shown.
9 changes: 9 additions & 0 deletions
9
modules/core/shared/src/main/scala/scaladex/core/model/HeadMetaProperty.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package scaladex.core.model | ||
|
||
/** | ||
* A meta tag in head that uses property attribute. | ||
* | ||
* @param property The property attribute | ||
* @param content The content attribute | ||
*/ | ||
case class HeadMetaProperty(property: String, content: String) |
30 changes: 30 additions & 0 deletions
30
modules/core/shared/src/main/scala/scaladex/core/model/OGP.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package scaladex.core.model | ||
|
||
/** | ||
* Open Graph Protocol, see https://ogp.me/ | ||
* | ||
* @param title | ||
* @param url | ||
* @param description | ||
* @param image | ||
* @param imageAlt | ||
*/ | ||
case class OGP( | ||
title: String, | ||
url: Url, | ||
description: String, | ||
image: Option[Url] = None, | ||
imageAlt: Option[String] = None | ||
) { | ||
val `type`: String = "article" | ||
val siteName: String = "Scaladex" | ||
def toHeadMetaProperty: Seq[HeadMetaProperty] = Seq( | ||
HeadMetaProperty(property = "og:title", content = title), | ||
HeadMetaProperty(property = "og:url", content = url.target), | ||
HeadMetaProperty(property = "og:type", content = `type`), | ||
HeadMetaProperty(property = "og:description", content = description), | ||
HeadMetaProperty(property = "og:site_name", content = siteName) | ||
) ++ image.map(c => HeadMetaProperty(property = "og:image", content = c.target)) ++ imageAlt.map(c => | ||
HeadMetaProperty(property = "og:image:alt", c) | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters