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

Persistent hypothes.is annotation after migrating pages #5

Open
bulbil opened this issue May 6, 2020 · 1 comment
Open

Persistent hypothes.is annotation after migrating pages #5

bulbil opened this issue May 6, 2020 · 1 comment

Comments

@bulbil
Copy link

bulbil commented May 6, 2020

I'm moving this issue here over from Ed1:

Thought you might be interested to know that, after chatting with the Hypothes.is folks and perusing this post on how Hypothes.is interacts with document metadata, I was able to "migrate" Hypothes.is annotations as I migrated my Ed instance to a new server.

I modified the _include/head.html to include DC metadata using Dublin Core tags with name attributes in addition to the Zotero-friendly property attributes. I also included a few site wide entries in _config.yml. As a result Hypothes.is associates annotations with a urn:x-dc: string rather than the URL.

If it sounds useful to other users, happy to issue a pull request.

@bulbil
Copy link
Author

bulbil commented May 6, 2020

AFIK, hypothes.is parses Dublin Core meta tags with a name attribute as opposed to property attribute.

After adding the following block to _includes/head.html I was able to see hypothes.is annotations migrate along with the page even though the URL changed.

I am under the impression only dc.identifier and dc.relation.ispartof are necessary for this functionality.

{% if site.dc %}
  <!-- Dublin Core metadata for hypothes.is -->
  <meta name="dc.title" content="{{ page.title }}" />
  <meta name="dc.creator" content="{% if page.author %}{{ page.author }}{% else %}{{ site.author.name }}{% endif %}" />
  {% if page.editor %}<meta name="dc.contributor" content="{{ page.editor }}" />{% endif %}
  {% if page.publication-date %}<meta name="dc.date" content="{{ page.publication-date }}" />{% endif %}
  {% if page.rights %}<meta name="dc.rights" content="{{ page.rights }}" />{% endif %}
  <meta name="dc.source" content='{% if page.source %}{{ page.source | escape_once }}{% else %}{{ site.title }}{% endif %}' />
  <meta name="dc.format" content="{% if page.dc.format %}{{ page.dc.format }}{% else %}{{ site.dc.format }}{% endif %}" />
  <meta name="dc.language" content="{% if page.dc.language %}{{ page.dc.language }}{% else %}{{ site.dc.language }}{% endif %}" />
  <meta name="dc.identifier" content="{{ resource_url }}" />
  <meta name="dc.relation.ispartof" content="{{ site.dc.relation_ispartof }}" />
{% endif %}

Here's the head.html include in question.

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

No branches or pull requests

1 participant