You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sometimes we don't want to show part of the web page to everyone, so we can encrypt our web page so that it can be accessed through a password. Similar to the following code, modify "your_site\layouts\posts\single.html", but it does not work for hugo-coder:
{{- $password := $params.password | default "" -}}
{{- if ne $password "" -}}
<script>
(function(){
if({{ $password }}){
if (prompt('please enter password') != {{ $password }}){
alert('password error!');
if (history.length === 1) {
window.opener = null;
window.open('', '_self');
window.close();
} else {
history.back();
}
}
}
})();
</script>
{{- end -}}
The text was updated successfully, but these errors were encountered:
Describe the enhancement
Enhanced function: Add article password
Sometimes we don't want to show part of the web page to everyone, so we can encrypt our web page so that it can be accessed through a password. Similar to the following code, modify "your_site\layouts\posts\single.html", but it does not work for hugo-coder:
The text was updated successfully, but these errors were encountered: