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

4723 org link preview #212

Merged
merged 3 commits into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
63 changes: 30 additions & 33 deletions ckanext/datagovtheme/templates/snippets/link_preview.html
Original file line number Diff line number Diff line change
@@ -1,42 +1,39 @@

{% block open_graph_previews %}
{% set pkg = c.pkg_dict %}
<!-- Set defaults -->
{% set dataset = "Data.gov Dataset" %}
{% set organization = "Data.gov" %}
{% set notes = "The Home of the U.S. Government's Open Data" %}
{% set img = "https://s3-us-gov-west-1.amazonaws.com/cg-0817d6e3-93c4-4de8-8b32-da6919464e61/hero-image-bg.png" %}

<!-- Set if pkg -->
{% set pkg = c.pkg_dict %}
{% if pkg %}
{% set dataset = pkg.title or pkg.name or "Data.gov Dataset" %}
{% set organization = pkg.organization.title or pkg.organization.name or "Data.gov" %}
{% set notes = h.markdown_extract(pkg.notes, 180) or "The Home of the U.S. Government's Open Data" %}

<!-- Facebook Meta Tags -->
<meta property="og:url" content="https://data.gov">
<meta property="og:type" content="website">
<meta property="og:title" content="{{ organization | forceescape }} - {{ dataset | forceescape }}">
<meta property="og:description" content="{{ notes | forceescape }}">
<meta property="og:image" content="{{ img }}">
{% set dataset = pkg.title or pkg.name %}
{% set organization = pkg.organization.title or pkg.organization.name %}
{% set notes = h.markdown_extract(pkg.notes, 180) %}
{% endif %}

<!-- Twitter Meta Tags -->
<meta name="twitter:card" content="summary_large_image">
<meta property="twitter:domain" content="data.gov">
<meta property="twitter:url" content="https://data.gov">
<meta name="twitter:title" content="{{ organization | forceescape }} - {{ dataset | forceescape }}">
<meta name="twitter:description" content="{{ notes | forceescape }}">
<meta name="twitter:image" content="{{ img }}">
{% else %}
<!-- Facebook Meta Tags -->
<meta property="og:url" content="https://data.gov">
<meta property="og:type" content="website">
<meta property="og:title" content="Data.gov Home - Data.gov">
<meta property="og:description" content="The Home of the U.S. Government's Open Data">
<meta property="og:image" content="{{ img }}">
<!-- Set if org -->
{% set org = c.group_dict %}
{% if org %}
{% set dataset = "Data.gov Organization" %}
{% set organization = org.title or org.name %}
{% set notes = h.markdown_extract(org.description, 180) %}
{% endif %}

<!-- Twitter Meta Tags -->
<meta name="twitter:card" content="summary_large_image">
<meta property="twitter:domain" content="data.gov">
<meta property="twitter:url" content="https://data.gov">
<meta name="twitter:title" content="Data.gov Home - Data.gov">
<meta name="twitter:description" content="The Home of the U.S. Government's Open Data">
<meta name="twitter:image" content="{{ img }}">
<!-- Facebook Meta Tags -->
<meta property="og:url" content="https://data.gov">
<meta property="og:type" content="website">
<meta property="og:title" content="{{ organization | forceescape }} - {{ dataset | forceescape }}">
<meta property="og:description" content="{{ notes | forceescape }}">
<meta property="og:image" content="{{ img }}">

{% endif %}
<!-- Twitter Meta Tags -->
<meta name="twitter:card" content="summary_large_image">
<meta property="twitter:domain" content="data.gov">
<meta property="twitter:url" content="https://data.gov">
<meta name="twitter:title" content="{{ organization | forceescape }} - {{ dataset | forceescape }}">
<meta name="twitter:description" content="{{ notes | forceescape }}">
<meta name="twitter:image" content="{{ img }}">
{% endblock %}
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

setup(
name="ckanext-datagovtheme",
version="0.2.33",
version="0.2.34",
description="CKAN Extension to manage data.gov theme",
long_description=long_description,
classifiers=[
Expand Down
Loading