Greetings according to day time

http://timomue.com Have a look.

Near the bottom is a line which alters its text!

The Macro therefore is (in German):

{% macro hour_based_greeting(config) %}
  {% set hour = "now"|date("G") %}
  {% set adjective = random(config.vocabulary.adjectives) %}
  {% if (hour < 6) %}
    Eine {{ adjective }}e Nacht!
  {% elseif (hour < 9) %}
    Einen {{ adjective }}en Morgen!
  {% elseif (hour < 12) %}
    Einen {{ adjective }}en Vormittag!
  {% elseif (hour < 15) %}
    Einen {{ adjective }}en Mittag!
  {% elseif (hour < 18) %}
    Einen {{ adjective }}en Nachmittag!
  {% elseif (hour < 22) %}
    Einen {{ adjective }}en Abend!
  {% else %}
    Eine {{ adjective }}e Nacht!
  {% endif %} 
{% endmacro %}

Besides from the greeting i use a list full of good adjectives in a config.vocabulary.adjectives.

config.vocabulary.adjectives
---

Can show me an example for your config.vocabulary.adjectives?

well it is very long

adjectives:
  - abenteuerlich
  - aktiv
  - angenehm
  - animalisch
  - anmutig
  - anregend
  - anspruchsvoll
  - anziehend
  - aphrodisierend
  - atemberaubend
  - athletisch
  - attraktiv
  - aufreizend
  - ausgelassen
  - außergewöhnlich
  - außerordentlich
  - bedeutend
  - beeindruckend 
  - beflügelt
  - befreiend
  - begehrenswert
  - begeisternd
  - beglückend
  - belebt
  - berauschend
  - berühmt
  - besonders
  - bewundernswert
  - bezaubernd
  - bildlich
  - brillant
  - charismatisch
  - charmant
  - dominant
  - duftend
  - dynamisch
  - echt
  - edel
  - ehrlich
  - einfühlsam
  - einzigartig
  - ekstatisch
  - elegant
  - emotional
  - empfehlenswert
  - entzückend
  - erfrischend
  - erhellend
  - erotisch
  - erregend
  - erstaunlich
  - erstklassig
  - exklusiv
  - extravagant
  - exzellent
  - fabelhaft
  - fantastisch
  - faszinierend
  - fein
  - fesselnd
  - feurig
  - freizügig
  - freudig
  - freundlich
  - frisch
  - fröhlich
  - geborgen
  - geheim
  - geheimnisvoll
  - geliebt
  - genüsslich
  - geschmackvoll
  - gespannt
  - gigantisch
  - glänzend
  - glücklich
  - grandios
  - gravierend
  - grenzenlos
  - großartig
  - harmonisch
  - heißblütig
  - hell
  - hemmungslos
  - herrlich
  - hervorragend
  - hübsch
  - hüllen
  - humorvoll
  - ideal
  - imponierend
  - individuell
  - instinktiv
  - intelligent
  - intensiv
  - interessant
  - klar
  - knallig
  - komfortabel
  - königlich
  - kostbar
  - kraftvoll
  - kunstvoll
  - lebendig
  - lebhaft
  - leidenschaftlich
  - leuchtend
  - liebenswert
  - lüstern
  - lustvoll
  - luxuriös
  - mächtig
  - magisch
  - märchenhaft
  - maximal
  - mitreißend
  - mysteriös
  - mystisch
  - packend
  - perfekt
  - persönlich
  - phänomenal
  - phantastisch
  - pikant
  - positiv
  - potent
  - prächtig
  - prall
  - rasant
  - real
  - reich
  - rein
  - reizend
  - riesig
  - riskant
  - romantisch
  - schamlos
  - scharf
  - schön
  - selbstlos
  - selbstsicher
  - selten
  - sensationell
  - sensibel
  - sexuell
  - sinnlich
  - spannend
  - spektakulär
  - sprachlos
  - spürbar
  - stark
  - stilvoll
  - stürmisch
  - sündig
  - sympathisch
  - traumhaft
  - überlegen
  - überwältigend
  - unfassbar
  - unglaublich
  - unsterblich
  - unwiderstehlich
  - verblüffend
  - verführerisch
  - verlockend
  - verwöhnt
  - vital
  - warm
  - weiblich
  - wertvoll
  - wild
  - wohlklingend
  - wohlriechend
  - wunderbar
  - wunderschön
  - wundervoll
  - zaghaft
  - zärtlich
  - zuverlässig
  - zwischenmenschlich
---

Nice macro :slight_smile:

hey @flaviocopes !!! Very short answer, but I appreciate that you like it !

This MACRO is absolutely MY contribution for the whole GRAV community (that makes german sites) … :slight_smile:

@timomue Please be fair and credit things right. To be clear this macro was developed in the post http://getgrav.org/forum#!/general:creating-helper-function based on my (starting) snippet and debugging help. Although I can not claim or have any copyright on this code (since it isn’t very complex), be careful to say, what is your own achievement/contribution or not… here it is your idea, that stands for the contribution and makes it worth it.

@Sommerregen Hey I am sorry. I thought it was my idea … you just helped with a line of code… the config variable that has to be provided ???

What should i say? Mention that you have helped me?

I never wanted to claim that I HAVE CREATED something … Was just very proud to have developed something valuable and useful for the COMMUNITY !!! Okay?

@timomue I totally understand and I don’t want to discourage you in any point. Your contribution is useful for the community and (as I have written) it is your idea :smiley:

I don’t want to claim it. I just wanted to be precise, that this code was based on the above posted thread (of course with some help of me, how much can anyone who reads it decide).

Keep on going. Everyone has started from scratch and is learning in a collaborative sense (that’s why we have this forum and gitter chat here). But please avoid writing something in capital letter (it always has the meaning of crying or shouting), which can be misunderstood.

:slight_smile: cool, thanks that you understand me… i am going to try avoiding it (writing in capital letters). Would be nice to develop along with you, in a sense of contributing to each other as well as it is possible :slight_smile:

Nice name, by the way… Sommerregen (it is german, are you German ?)

Have a nice day!
Timo

@timomue Yes, it’s german and I am German, too.

All the best,
Sommerregen

super. Webentwickler auch von Berufswegen ? Oder nur Hobby-mäßig ???

Das ist meine Freizeitaktivität. Bin ansonsten Physiker. Wie ich dazu komme? längere Geschichte werde ich hier nicht weiter ausbreiten :wink:

okay… :slight_smile: also mehr so der Techniker ???

i like that you help others with your expertise! Thanks.

but now let’s leave this place, our small talk has nothing to do with GRAV !