Skip to content

Conversation

@AldenWangExis
Copy link

Type of change

  • New feature (non-breaking change which adds functionality)

Description

This PR adds referrer policy support to prevent HTTP Referer headers from being sent when loading images. This enhancement is particularly useful for:

  1. Privacy protection: Prevents external image hosts from tracking where images are being displayed
  2. Hotlink protection bypass: Enables displaying images from platforms with referrer-based hotlink protection (e.g., WeChat Official Account images)
  3. Enhanced security: Reduces information leakage to third-party image servers

Features #2586

Changes Made

  1. Meta Tag in Head (head.html)
  2. Image Tag Attributes (refactor-content.html)
  3. Sidebar Avatar (sidebar.html)

Technical Details

  • Backward Compatible: These changes do not break any existing functionality
  • Standards Compliant: Uses standard HTML5 referrerpolicy attribute
  • Comprehensive Coverage: Applies to all images rendered through Jekyll/Liquid templates
  • Performance Impact: Minimal (only adds one HTML attribute per image)

Testing

Tested with:

  • WeChat Official Account images (mmbiz.qpic.cn domain)
  • Various image formats (jpg, png, gif)
  • Both lazy-loaded and LQIP images
  • Avatar images in sidebar
  • Images with different Kramdown attributes (.shadow)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant