add wordcount feature

This commit is contained in:
2023-01-17 22:01:02 +01:00
parent 38a713efa7
commit 55e8fe2422
3 changed files with 15 additions and 1 deletions

View File

@@ -204,6 +204,18 @@ form:
size: medium
default: ""
owner_title:
type: text
label: Owner title
size: medium
default: ""
wordcount_title:
type: text
label: Word count title
size: medium
default: ""
analytics:
type: textarea
label: Analytics script

View File

@@ -1,4 +1,6 @@
enabled: true
owner_title:
wordcount_title:
analytics:
social_buttons:
contact:

View File

@@ -5,7 +5,7 @@
<article class="post">
<h2>{{ page.title }}</h2>
<div class="meta">
<p>{{ page.date|date("d.m.Y H:i") }}{% if config.plugins.readingtime.enabled %}&nbsp;|&nbsp;{{ page.content|readingtime }}{% endif %}</p>
<p>{{ page.date|date("d.m.Y H:i") }}{% if config.plugins.readingtime.enabled %}&nbsp;|&nbsp;{{ page.content|readingtime }}{% endif %}{% if config.plugins.wordcount.enabled and grav.user.title == theme_config.owner_title %}&nbsp;|&nbsp;{{ getWordCount(content) }}&nbsp;{{ theme_config.wordcount_title }}{% endif %}</p>
<p>Tagi: {% for tag in page.taxonomy.tag %}<a href="{{ theme_config.blog.slug }}/tag:{{tag}}">{{ tag }}</a>&ensp;{% endfor %}</p>
</div>
{{ page.content | raw }}