Skip to content

Commit 636cf7b

Browse files
committed
updated the post
1 parent cb77272 commit 636cf7b

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

content/posts/adding_password_protection_to_a_hugo_post.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Before we proceed, open the post [Top Secret](http://localhost:1313/posts/top_se
2727
----
2828
## 1. Add a new parameter, `password`
2929
To give you a sense of what I mean by "Add a new parameter" take a look at the `password` parameter at the line [#9](https://github.com/lazydeveloper/lazydeveloper.github.io/blob/1477fa46fe7425899d15470398e4405f6c0cfb0a/content/posts/top_secret.md?plain=1#L8) in the code below.
30-
```
30+
```markdown
3131
---
3232
title: "Top Secret"
3333
description: "Password to open the top secret: 1234 "
@@ -49,12 +49,12 @@ It's time to write the logic, Let's add a script to the default post layout. In
4949
**Add the following code snippets to your layout file (single.html).**
5050

5151
01. Add this div at the starting of the article class. This will ensures that the content is hidden initially if a password is set.
52-
```
52+
```html
5353
<div id="content-container" {{- if .Params.password -}}style="display: none;"{{- end -}}>
5454
```
5555

5656
02. Now add this code at the end of your layout file. The <script> handles the password prompt and reveals the content if the correct password is entered.
57-
```
57+
```html
5858
<script>
5959
window.onload = function() {
6060
var contentContainer = document.getElementById("content-container");

public/sitemap.xml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
33
xmlns:xhtml="http://www.w3.org/1999/xhtml"
44
><url>
5-
<loc>https://shiva.dev/posts/adding_password_protection_to_a_hugo_post/</loc><lastmod>2024-07-09T01:52:13-04:00</lastmod></url><url>
6-
<loc>https://shiva.dev/categories/</loc><lastmod>2024-07-09T01:52:13-04:00</lastmod></url><url>
7-
<loc>https://shiva.dev/categories/development/</loc><lastmod>2024-07-09T01:52:13-04:00</lastmod></url><url>
8-
<loc>https://shiva.dev/tags/hugo/</loc><lastmod>2024-07-09T01:52:13-04:00</lastmod></url><url>
9-
<loc>https://shiva.dev/</loc><lastmod>2024-07-09T01:52:13-04:00</lastmod></url><url>
10-
<loc>https://shiva.dev/tags/</loc><lastmod>2024-07-09T01:52:13-04:00</lastmod></url><url>
5+
<loc>https://shiva.dev/posts/adding_password_protection_to_a_hugo_post/</loc><lastmod>2024-07-09T08:28:49-04:00</lastmod></url><url>
6+
<loc>https://shiva.dev/categories/</loc><lastmod>2024-07-09T08:28:49-04:00</lastmod></url><url>
7+
<loc>https://shiva.dev/categories/development/</loc><lastmod>2024-07-09T08:28:49-04:00</lastmod></url><url>
8+
<loc>https://shiva.dev/tags/hugo/</loc><lastmod>2024-07-09T08:28:49-04:00</lastmod></url><url>
9+
<loc>https://shiva.dev/</loc><lastmod>2024-07-09T08:28:49-04:00</lastmod></url><url>
10+
<loc>https://shiva.dev/tags/</loc><lastmod>2024-07-09T08:28:49-04:00</lastmod></url><url>
1111
<loc>https://shiva.dev/posts/top_secret/</loc><lastmod>2024-07-09T01:38:52-04:00</lastmod></url><url>
1212
<loc>https://shiva.dev/posts/lunr_search_for_hugo/</loc><lastmod>2024-06-23T13:12:21-04:00</lastmod></url><url>
1313
<loc>https://shiva.dev/tags/lunr/</loc><lastmod>2024-06-23T13:12:21-04:00</lastmod></url><url>

0 commit comments

Comments
 (0)