Share Hub - Tag-Based Document Sharing Portal

Overview

Share Hub is a Jekyll-based document sharing portal with tag-based access control. Documents can be public or private based on tags in their front matter, not their folder location. All documents are stored in a single documents/ folder for better organization.

πŸ†• Tag-Based Protection System

Unlike traditional folder-based protection, Share Hub uses front matter tags to control access:

  • Public files: No access tag needed (default)
  • Private files: Add access: private in front matter
  • Password: β€œmaco” for all private documents

Repository Structure

sharehub/
β”œβ”€β”€ documents/          # All documents (both public and private)
β”‚   β”œβ”€β”€ *.md           # Markdown files
β”‚   β”œβ”€β”€ *.html         # HTML files
β”‚   └── [subfolders]/  # Optional organization by topic
β”œβ”€β”€ _layouts/          # Jekyll layouts (DO NOT MODIFY)
β”‚   └── universal.html # Universal layout with protection logic
└── index.html         # Main listing page

File Upload Guidelines

1. Public Documents

Documents are public by default. Simply upload to documents/ folder.

For Markdown files (.md):

---
title: "Document Title"
date: 2025-01-15
---

Your content here...

For HTML files (.html):

---
title: "Document Title"
---
<!DOCTYPE html>
<html>
...
</html>

2. Private Documents

Add access: private tag to make any document password-protected.

For Markdown files (.md):

---
title: "Confidential Document"
date: 2025-01-15
access: private
---

Your confidential content here...

For HTML files (.html):

---
title: "Confidential Document"
access: private
---
<!DOCTYPE html>
<html>
...
</html>

3. Organizing with Subfolders

Create subfolders within documents/ for topical organization:

documents/
β”œβ”€β”€ reports/
β”‚   β”œβ”€β”€ quarterly_report.md
β”‚   └── annual_summary.html
β”œβ”€β”€ presentations/
β”‚   └── product_launch.md
└── internal/
    └── strategy.md (with access: private)

Key Features

Index Page Behavior

  • Before login: Shows only public documents
  • After login: Shows all documents (public + private)
  • Visual indicators:
    • πŸ”’ Lock icon for private files
    • Folder badges for files in subfolders
  • Default view: HTML/MD files only (checkbox to show all file types)
  • Sorting: Alphabetical by title/folder name

Document Access

  • Files without access: private β†’ Publicly accessible
  • Files with access: private β†’ Password required (β€œmaco”)
  • Session-based: Password remembered until browser closed

Git Workflow

Step 1: Pull Latest Changes

git pull origin main

Step 2: Add Your Document

Place your file in documents/ folder with appropriate front matter.

Step 3: Commit Changes

git add documents/[filename]
git commit -m "Add [type]: [description]"

Example commit messages:

  • β€œAdd public report: Q1 2025 marketing analysis”
  • β€œAdd private document: Confidential financial data”

Step 4: Push to Repository

git push origin main

Quick Guide for Adding Files

πŸ“„ Public Document (Default)

Simply place your file in documents/ folder with minimal front matter:

Simplest (title from filename):

---
---
Content here...

With custom title (optional):

---
title: "Custom Title"
---
Content here...

πŸ”’ Private Document

Just add access: private - that’s all you need:

Simplest:

---
access: private
---
Private content...

With custom title (optional):

---
title: "Custom Title"
access: private
---
Private content...

🎯 Automatic Fallbacks

  • No title? β†’ Uses filename (e.g., my-report.md β†’ β€œmy report”)
  • No date? β†’ Uses file modification time
  • No author? β†’ Not required

πŸ“ Using Subfolders

Organize with folders - they’ll show as badges:

documents/
β”œβ”€β”€ Reports/Q1/financial.md     β†’ Shows [Reports/Q1]
β”œβ”€β”€ Presentations/demo.html     β†’ Shows [Presentations]
└── strategy.md                 β†’ No badge

⚑ That’s It!

  • Password: β€œmaco” for all private files (change in index.html line ~625: const correctPassword = 'maco';)
  • Default: Files are public unless tagged private
  • Git: git add, commit, and push to publish
  • Wait: 1-5 minutes for GitHub Pages to update

URL Structure After Upload

Documents are accessible at:

GitHub Pages (default):

  • https://[username].github.io/[repository]/documents/[filename]

Custom Domain:

  • https://[your-domain]/documents/[filename]

Relative paths (always work):

  • From index: ./documents/[filename]
  • From anywhere: /documents/[filename]

Migration from Folder-Based System

If you have existing files in public/ and private/ folders:

  1. Move all files to documents/ folder
  2. Add access: private to front matter of previously private files
  3. Remove old public/ and private/ folders
  4. Commit and push changes

Important Notes

  1. Default Access: Files are public unless access: private is specified
  2. Password: All private files use password β€œmaco” (To change: edit index.html line ~625: const correctPassword = 'maco';)
  3. Jekyll Processing: GitHub Pages automatically converts .md to HTML
  4. Build Time: Changes take 1-5 minutes to appear after pushing
  5. File Size: Keep files under 100MB for optimal performance
  6. Front Matter: Required for all .md and .html files

How to Change the Password:

  1. Open index.html
  2. Search for: const correctPassword = 'maco';
  3. Replace 'maco' with your desired password
  4. Commit and push the change

Troubleshooting

Document Not Appearing

  • Verify YAML front matter syntax
  • Check file is in documents/ folder
  • Wait 5 minutes for GitHub Pages rebuild
  • Clear browser cache

Access Issues

  • Private files need access: private in front matter
  • Password is case-sensitive: β€œmaco”
  • Session storage keeps you logged in until browser closes

Formatting Issues

  • Validate YAML syntax (use spaces, not tabs)
  • Check markdown formatting
  • Ensure HTML is well-formed

Advanced Features

Custom Passwords (Future)

While currently all private files use β€œmaco”, the system is designed to support custom passwords per file:

---
access: private
password_hash: "SHA256_HASH_HERE"
---

Tags and Categories

Use tags for better organization:

---
title: "Document Title"
tags: [report, financial, q1-2025]
category: finance
access: private
---

Support

For issues or questions, check the repository issues page or contact the administrator.