hugo-PaperMod icon indicating copy to clipboard operation
hugo-PaperMod copied to clipboard

Add a "Off The Record" / Hidden post mode

Open RoneoOrg opened this issue 3 years ago • 21 comments
trafficstars

What does this PR change? What problem does it solve?

I sometime want to share a post with selected readers only, for review or private discussion.

This branch adds a Front Matter variable offTheRecord, which allows you to publish a post and share the URL while hiding this post from:

  • the post list on the homepage
  • the archive page
  • the search results
  • the RSS feeds
  • the Sitemap

The search engine indexation is also set to noindex, nofollow for these posts.

What's left to do?

  • hide the post from the /tags/ pages (#wontfix: I do not use tags in OTR posts)
  • hide posts from section pages (details: consider a page http://localhost:1313/blogg/markdown/ - the page is successfully hidden from home but is listed at http://localhost:1313/blogg/)
  • check schema_json
  • update the documentation
  • write a disclaimer:

Do not rely on this for strong confidentiality The post can be found in your Git repo, if it's public and the URL can be guessed if too obvious [...] The way you share the link matters. See "Gmail is opening and caching URLs within emails without user intervention" for example [...]

This branch is published early, unpolished, for the interested. I will probably have no time to work on it in the near future, feel free to build upon / close this PR

Was the change discussed in an issue or in the Discussions before?

Not on this tracker, but this is an implementation of an idea by Zachary Wade Betz, reviewed and discussed on discourse.gohugo.io.

PR Checklist

  • [x] I have enabled maintainer edits for this PR.
  • [x] I have verified that the code works as described/as intended.
  • [x] This change does not include any CDN resources/links.
  • [x] This change does not include any unrelated scripts such as bash and python scripts.
  • [ ] This change updates the overridden internal templates from HUGO's repository.

RoneoOrg avatar Jan 05 '22 09:01 RoneoOrg

Updated

RoneoOrg avatar Jan 05 '22 09:01 RoneoOrg

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

sonarqubecloud[bot] avatar Jan 05 '22 09:01 sonarqubecloud[bot]

Update: the hidden posts are now properly excluded from the Sitemap

RoneoOrg avatar Mar 31 '22 01:03 RoneoOrg

Note: this branch is temporarily broken - Update: fixed

RoneoOrg avatar Mar 31 '22 01:03 RoneoOrg

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

sonarqubecloud[bot] avatar Mar 31 '22 02:03 sonarqubecloud[bot]

The branch was rewritten to include the last changes published upstream

RoneoOrg avatar Mar 31 '22 02:03 RoneoOrg

I finally published a post about this feature integration in Papermod: https://roneo.org/en/hugo-hidden-posts/

RoneoOrg avatar Apr 01 '22 03:04 RoneoOrg

@RoneoOrg The page is still listed in

  • tags and term pages

Hi and thanks for the review!

The tag stuff is a known issue and I won't work on it in the near future.

Quoting myself:

What's left to do?

  • hide the post from the /tags/ pages (#wontfix: I do not use tags in OTR posts)

The only change I may contribute is to rename the feature from OffTheRecord (too pedantic IMHO) to something like private

The page is still listed in

  • section pages

Nice catch! I'm adding this issue to the list in the first post^^

RoneoOrg avatar Jun 02 '22 13:06 RoneoOrg

In an ideal scenario, only single.html should generate the page and everywhere else it should be bypassed

We won't merge it until it works everywhere. Because you don't use tags you'll not be fixing it 🤷‍♂️.

We won't go ahead with this one then until someone else makes a PR who wishes to make it work everywhere.

adityatelange avatar Jun 02 '22 13:06 adityatelange

We won't merge it until it works everywhere

Sure! I'll ping the devs that showed interest in this feature

RoneoOrg avatar Jun 02 '22 22:06 RoneoOrg

I'll ping the devs that showed interest in this feature

That's a shame: I can't retrieve the usernames of the people who thumbed up this PR. I wanted to invite them to contribute to these last fixes, but I can't apparently ping them.

RoneoOrg avatar Jun 02 '22 22:06 RoneoOrg

I'll ping the devs that showed interest in this feature

That's a shame: I can't retrieve the usernames of the people who thumbed up this PR. I wanted to invite them to contribute to these last fixes, but I can't apparently ping them.

Try this image

adityatelange avatar Jun 03 '22 13:06 adityatelange

Try this

Yes that's what I did, but Github autocompletion did not find any match, I guess these visible account names do not correspond to the usernames I could ping with @yashasomething for example

RoneoOrg avatar Jun 03 '22 13:06 RoneoOrg

Try this

Yes that's what I did, but Github autocompletion did not find any match, I guess these visible account names do not correspond to the usernames I could ping with @yashasomething for example

Okay @RoneoOrg


@yashasolutions, @philipgriffin, @Th3Shadowbroker, and @gtreshchev Please help us with this PR if anyone is available

adityatelange avatar Jun 03 '22 13:06 adityatelange

sorry didn't see the notification earlier, is there anything that need to be done?

yashasolutions avatar Jun 11 '22 10:06 yashasolutions

Hi there,

here is a recap of the stuff to be done:

  • [ ] 1. Hide posts from section pages (see these details)
  • [ ] 2. Hide post from the /tags/ pages
  • [ ] 3. Hide posts from series pages
  • [ ] 4. Check if the posts appear in schema.json
  • [ ] 5. Determine an appropriate name for this feature
    (candidates: offTheRecord / privatePost / privatePage / or simply private ?)
  • [ ] 6. Write a disclaimer (see this suggestion)
  • [ ] 7. Update the documentation

/cc @yashasolutions

RoneoOrg avatar Jun 11 '22 13:06 RoneoOrg

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

sonarqubecloud[bot] avatar Jun 23 '22 00:06 sonarqubecloud[bot]

Now every external link is opened is a new tab with rel=noreferrer, to hide the Referer header and leak no referrer information

RoneoOrg avatar Jun 28 '22 19:06 RoneoOrg

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

sonarqubecloud[bot] avatar Aug 16 '22 08:08 sonarqubecloud[bot]

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

sonarqubecloud[bot] avatar Sep 30 '22 21:09 sonarqubecloud[bot]

Todo:

  • [ ] Check if hidden posts are correctly hidden from navigation (Previous / Next buttons at the bottom of posts)
  • [ ] Check the compatibilty with this PR #1049

RoneoOrg avatar Jul 06 '23 07:07 RoneoOrg