base.html 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <!DOCTYPE html>
  2. <html lang="zh-CN">
  3. <head>
  4. <meta charset="UTF-8" />
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  6. <title>{% block title %}个人博客{% endblock %}</title>
  7. <link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}" />
  8. {% block extra_head %}{% endblock %}
  9. <!-- MathJax 配置 -->
  10. <script>
  11. MathJax = {
  12. tex: {
  13. inlineMath: [['$', '$'], ['\\(', '\\)']]
  14. },
  15. svg: {
  16. fontCache: 'global'
  17. }
  18. };
  19. </script>
  20. <script src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js" id="MathJax-script" async></script>
  21. </head>
  22. <body>
  23. <nav class="navbar">
  24. <div class="nav-container">
  25. <a href="{{ url_for('index') }}" class="nav-brand">博客</a>
  26. <ul class="nav-links">
  27. <li><a href="{{ url_for('index') }}">首页</a></li>
  28. <li><a href="{{ url_for('upload') }}" class="add-post-btn">+ 增加文章</a></li>
  29. <li><a href="{{ url_for('admin') }}">管理</a></li>
  30. </ul>
  31. </div>
  32. </nav>
  33. <div class="flash-container">
  34. {% with messages = get_flashed_messages(with_categories=true) %}
  35. {% if messages %}
  36. <ul class="flashes">
  37. {% for category, message in messages %}
  38. <li class="flash-{{ category }}">{{ message }}</li>
  39. {% endfor %}
  40. </ul>
  41. {% endif %}
  42. {% endwith %}
  43. </div>
  44. <main class="main-content">
  45. <div class="post-container">
  46. {% block content %}{% endblock %}
  47. </div>
  48. </main>
  49. <footer class="footer">
  50. <p>&copy; 2026 个人博客系统</p>
  51. </footer>
  52. <script src="{{ url_for('static', filename='js/main.js') }}"></script>
  53. {% block extra_scripts %}{% endblock %}
  54. </body>
  55. </html>