Closed chenx2018 closed 2 years ago
Please do not ignore the issue guide, which asked you to mention cross-posting if you did: https://stackoverflow.com/q/70620858/559676
This question is out of the scope of blogdown but a question purely on Hugo and Netlify. If no one replies you on Stack Overflow, you may try the Hugo forum, but please do include a reproducible example (which is also what the issue guide required but you didn't provide). The short answer is that you add these code to a certain Hugo template file. Without you providing an example, it's hard to tell you which file.
Thanks for your suggestion! 感谢谢大大回复~
UPDATE:
I found two approaches might be helpful:
netlify-plugin-password-protection, which applies staticrypt.
Another tutorial: Password-protected pages on Netlify.
For a reproducible example, the Hugo Theme I used in blogdown
is pulp
, the file structure is the following:
.
└── pulp
├── .editorconfig
├── .eslintrc.json
├── .gitignore
├── LICENSE.md
├── README.md
├── archetypes
│ └── default.md
├── assets
│ ├── css
│ │ ├── markdown-dark.css
│ │ ├── markdown.css
│ │ ├── style-dark.css
│ │ ├── style.css
│ │ └── syntax-highlight.css
│ └── js
│ ├── jquery-3.3.1.min.js
│ ├── jquery.mark.es6.min.js
│ ├── lunr.js
│ └── search.js
├── exampleSite
│ ├── .gitignore
│ ├── config.toml
│ ├── content
│ │ └── blog
│ │ ├── emoji-support.md
│ │ ├── markdown-syntax.md
│ │ ├── math-typesetting.mmark
│ │ ├── placeholder-text.md
│ │ └── rich-content.md
│ └── static
│ ├── css
│ │ └── custom.css
│ ├── img
│ │ ├── avatar.jpg
│ │ └── favicon.ico
│ └── js
│ └── custom.js
├── images
│ ├── logo.png
│ ├── screenshot.png
│ └── tn.png
├── layouts
│ ├── 404.html
│ ├── _default
│ │ ├── baseof.html
│ │ ├── list.html
│ │ ├── list.json
│ │ ├── single.html
│ │ └── terms.html
│ ├── index.html
│ └── partials
│ ├── footer.html
│ ├── head.html
│ └── header.html
├── package.json
├── resources
│ └── _gen
│ └── assets
│ ├── css
│ │ ├── style0.css_d11fe7b62c27961c87ecd0f2490357b9.content
│ │ └── style0.css_d11fe7b62c27961c87ecd0f2490357b9.json
│ └── js
│ ├── bundle0.js_d11fe7b62c27961c87ecd0f2490357b9.content
│ └── bundle0.js_d11fe7b62c27961c87ecd0f2490357b9.json
├── static
│ ├── .DS_Store
│ ├── categories
│ │ └── img
│ │ ├── avatar.png
│ │ ├── clear.png
│ │ ├── favicon.ico
│ │ └── search.png
│ └── img
│ ├── avatar-border.svg
│ ├── avatar.jpg
│ ├── bu.png
│ ├── clear.png
│ ├── favicon.ico
│ └── search.png
├── theme.toml
└── yarn.lock
R blogdown is super convenient to publish Rmarkdown report using netlify.
In order to build a private blog and control access, I found netlify identity widget could be a solution. Useful reference are:
Authenticate users with Netlify Identity
netlify identity widget
From the README file in netlify identity widget
Which blogdown file should I add above code into?
How to integrate netlify identity widget into R blogdown?
Thanks a lot!