weichenw / obsidian-hypothesis-plugin

An Obsidian.md plugin that syncs highlights from Hypothesis.
MIT License
235 stars 20 forks source link

Creation date as backlink #24

Closed Mirtma closed 2 years ago

Mirtma commented 2 years ago

Is it possible to have the creation date as backlink [[YYYY-MM-DD]] in a template, so that my daily note would show it at linked mentions?

weichenw commented 2 years ago

You will have to change the date format. Then adjust the nunjuck template to use [[{{highlight.created}}]]

image

Mirtma commented 2 years ago

Hello, thank you for your reply! But I can't get it to work. It always shows me the date and link to the article. Where exactly should I insert that variable?

Kind regards, Matjaž

V V čet., 16. dec. 2021 ob 14:43 je oseba Wei Chen @.***> napisala:

You will have to change the date format. Then adjust the nunjuck template to use [[{{highlight.created}}]]

[image: image] https://user-images.githubusercontent.com/9876456/146382887-ca431eee-034d-411b-b5b2-2c173616f14b.png

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/weichenw/obsidian-hypothesis-plugin/issues/24#issuecomment-995830389, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAPK2LXAGJ2XQUIMMVWDLPLURHUHPANCNFSM5KDOPZVA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

Mirtma commented 2 years ago

I only get these:

[image: image.png]

V V čet., 16. dec. 2021 ob 15:01 je oseba Matjaž @.***> napisala:

Hello, thank you for your reply! But I can't get it to work. It always shows me the date and link to the article. Where exactly should I insert that variable?

Kind regards, Matjaž

V V čet., 16. dec. 2021 ob 14:43 je oseba Wei Chen < @.***> napisala:

You will have to change the date format. Then adjust the nunjuck template to use [[{{highlight.created}}]]

[image: image] https://user-images.githubusercontent.com/9876456/146382887-ca431eee-034d-411b-b5b2-2c173616f14b.png

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/weichenw/obsidian-hypothesis-plugin/issues/24#issuecomment-995830389, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAPK2LXAGJ2XQUIMMVWDLPLURHUHPANCNFSM5KDOPZVA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

weichenw commented 2 years ago

mage: image.png]

Hi, can reattach the image? Doesn't seem to load

Mirtma commented 2 years ago

Of course!

V V pet., 17. dec. 2021 ob 12:40 je oseba Wei Chen @.***> napisala:

mage: image.png]

Hi, can reattach the image? Doesn't seem to load

— Reply to this email directly, view it on GitHub https://github.com/weichenw/obsidian-hypothesis-plugin/issues/24#issuecomment-996657257, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAPK2LUOAHRDB2CTYLZPUM3URMOR7ANCNFSM5KDOPZVA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you authored the thread.Message ID: @.***>

weichenw commented 2 years ago

For whatever reason, image is not getting attached

Mirtma commented 2 years ago

Well, it shows that instead of creation date it only shows [[]] where the date should be.

On Sat, 18 Dec 2021, 01:20 Wei Chen, @.***> wrote:

For whatever reason, image is not getting attached

— Reply to this email directly, view it on GitHub https://github.com/weichenw/obsidian-hypothesis-plugin/issues/24#issuecomment-997104411, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAPK2LVYG3LAO3VE7NZ6NFDURPHVVANCNFSM5KDOPZVA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you authored the thread.Message ID: @.***>

Mirtma commented 2 years ago

Zajeta slika

weichenw commented 2 years ago

try the nunjuck template below;

{% if is_new_article %}# {{title}}

## Metadata
{% if author %}- Author: [{{author}}]({{authorUrl}}){% endif %}
- Title: {{title}}
{% if url %}- Reference: {{url}}{% endif %}
- Category: #article{% endif %}

{% if is_new_article -%}## Highlights{%- endif %}
{% for highlight in highlights -%}- {{highlight.text}} — Created on [[{{highlight.created}}]], [Updated on {{highlight.updated}}]({{highlight.incontext}}) {% if 'Private' != highlight.group %} — Group: #{{highlight.group| replace(" ", "-")}}{%- endif %}
{% if highlight.tags | length %}   - Tags: {% for tag in highlight.tags -%} #{{tag | replace(" ", "-")+" "}}{%- endfor %}{%- endif %}
{% if highlight.annotation %}   - Annotation: {{highlight.annotation}}{%- endif -%}{%- endfor -%}
Mirtma commented 2 years ago

Thank you! Now it shows as I want.

Kind regards, Matjaž

V V sob., 18. dec. 2021 ob 14:51 je oseba Wei Chen @.***> napisala:

try the nunjuck template below;

{% if is_new_article %}# {{title}}

Metadata

{% if author %}- Author: {{author}}{% endif %}

  • Title: {{title}}

{% if url %}- Reference: {{url}}{% endif %}

  • Category: #article{% endif %}

{% if is_new_article -%}## Highlights{%- endif %}

{% for highlight in highlights -%}- {{highlight.text}} — Created on [[{{highlight.created}}]], Updated on {{highlight.updated}} {% if 'Private' != highlight.group %} — Group: #{{highlight.group| replace(" ", "-")}}{%- endif %}

{% if highlight.tags | length %} - Tags: {% for tag in highlight.tags -%} #{{tag | replace(" ", "-")+" "}}{%- endfor %}{%- endif %}

{% if highlight.annotation %} - Annotation: {{highlight.annotation}}{%- endif -%}{%- endfor -%}

— Reply to this email directly, view it on GitHub https://github.com/weichenw/obsidian-hypothesis-plugin/issues/24#issuecomment-997205584, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAPK2LTDSQ52SAUQPHLUXUDURSGWPANCNFSM5KDOPZVA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you authored the thread.Message ID: @.***>