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

use dataset thumbnail if available #5621

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/main/webapp/dataset.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
<meta property="og:title" content="#{DatasetPage.title}" />
<meta property="og:type" content="article" />
<meta property="og:url" content="#{DatasetPage.dataverseSiteUrl}/dataset.xhtml?persistentId=#{dataset.globalId}" />
<meta property="og:image" content="#{DatasetPage.dataverseSiteUrl.concat(resource['images/favicondataverse.png'])}" />
<meta property="og:image" content="#{DatasetPage.dataset.getDatasetThumbnail() == null ? DatasetPage.dataverseSiteUrl.concat(resource['images/favicondataverse.png']): DatasetPage.dataverseSiteUrl.concat('/api/datasets/:persistentId/thumbnail?persistentId=').concat(DatasetPage.dataset.getGlobalId().asString())}" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@qqmyers -- one question I have about this og:image file path is if it requires the dataverseSiteUrl in your installation? In my initial local and AWS tests, it seems that a relative path with just content="#{resource['images/...']}" to the default image file works with no problem.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mheppler - I'm not sure how you're testing, but it may be that relative URLs are OK for some uses. I think we went with a full URL based on https://stackoverflow.com/a/9858694 and looking at https://developers.facebook.com/tools/debug/og/object/ which gives an error such as
image
with a relative URL.

That said, Facebook also complains about the article:author field not being a profile (minimally a URL for the person), and doesn't like images less than 200x200... other things that could/should be fixed but that don't appear to cause trouble in slack for example...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, that might explain the lack of complaints on my end. I haven't checked my local development on the Facebook yet. (That's on today's agenda.) The dataset thumbnail image size was also something I was going to experiment today, so I am glad to hear you've already gone down that route.

<meta property="og:site_name" content="#{DatasetPage.publisher}" />
<meta property="og:description" content="#{(DatasetPage.description.length()>150 ? DatasetPage.description.substring(0,147).concat('...'): DatasetPage.description)}" />
<ui:repeat var="author" value="#{DatasetPage.datasetAuthors}">
Expand Down