Yukuro / hugo-theme-shell

Hugo Shell theme : Terminal-like theme with selectable color schemes.

Home Page:https://hugo-theme-shell-example.vercel.app/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How can I only play the main page terminal animation once on the user's first visit.

supertsumu opened this issue · comments

Question is stated as above. Sorry if this isnt the place to post questions.

Thanks for the question.


How can I only play the main page terminal animation once on the user's first visit.

Does that mean disabling typing animations when a user visits?

If so, you can disable them by setting config.toml as follows

  • [Params] > [Params.Terminal] > commandDelay = 0

I was thinking when the user visits the home page for the first time, the typing animation plays, but once the user loads the home page again it doesnt play. I think I can try to implement your above solutions with some cookies maybe that will work. Thanks!

I did following change to partials/typeIndex.html

let commandDelay = parseDelay("{{ .commanddelay }}"); // line 54

if (sessionStorage.getItem("typeEffect")) {
    commandDelay = 0;
};
sessionStorage.setItem("typeEffect", true);

const typeeffetct = async () => {

The sessionStorage clears if the tab is closed. It just lives and dies with its tab.
Two tabs don't share the sessionStorage values.
In my case, it's requested behaviour.
Possibly, you may want to use localStorage instead.