Skip to content

Commit

Permalink
added feed
Browse files Browse the repository at this point in the history
  • Loading branch information
abhinavis2005 committed May 22, 2024
1 parent 2aa898d commit e18f4ec
Show file tree
Hide file tree
Showing 10 changed files with 230 additions and 10 deletions.
1 change: 1 addition & 0 deletions config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ compile_sass = false
minify_html = true
generate_feed = true
default_language = "en"
output_dir = "docs"

taxonomies = [
{name = "tags", feed = true},
Expand Down
2 changes: 1 addition & 1 deletion content/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Official blog of Cybersecurity Club, IIT Madras.
## Posts


- [First Post](./blog/first-post)
- [First Post](./blog/posts/first-post)

## Tags

Expand Down
9 changes: 0 additions & 9 deletions content/blog/_index.md

This file was deleted.

File renamed without changes.
Binary file added docs/click.ogg
Binary file not shown.
105 changes: 105 additions & 0 deletions docs/css/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
#nav-bar {
padding: .625rem 0 0 0;
display: flex;
flex-direction: row;
gap: .25rem;
flex-wrap: wrap;
justify-content: flex-end;
align-items: center;
align-content: flex-end
}

#footer-container {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
align-items: center;
}

.accent-data {
color: var(--accent);
}

.theme-transition {
transition: color 0.3s ease, background-color 0.3s ease;
}

.tags-data {
display: flex;
flex-direction: column;
flex-wrap: wrap;
justify-content: flex-end;
align-items: flex-start;
align-content: flex-end
}

.title-list li {
margin-bottom: .375rem;
}

/* icons settings */
.icons {
width: 1.3rem;
height: 1.3rem;
aspect-ratio: 1/1;
display: inline-block;
vertical-align: middle;
color: var(--text);
fill: var(--text);
background-color: transparent;
cursor: pointer;
}

.icons:hover {
background-color: transparent;
color: var(--accent);
}

/* footnotes */
.footnote-definition {
margin: 0 0 0 .125rem;
}

.footnote-definition-label {
color: var(--accent);
}

.footnote-definition p {
display: inline;
margin: .625rem 0 0 .625rem;
}

/* general classes */
.no-style {
padding: 0;
margin: 0;
border: none;
border-radius: 0
}

.no-style:hover {
background-color: transparent;
color: var(--accent);
}

.center {
text-align: center;
}

.center img {
display: block;
margin: 1rem auto;
}

.float-right {
float: right
}

.float-left {
float: left
}

/* shortcodes css */
.webring {
margin: .375rem;
}
Binary file added docs/favicon.ico
Binary file not shown.
21 changes: 21 additions & 0 deletions docs/icons.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
49 changes: 49 additions & 0 deletions docs/js/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
const toggleButton = document.getElementById('theme-toggle');
const themeIcon = document.getElementById('theme-icon');
const themeSound = document.getElementById('theme-sound');

// Function to update the theme icon based on the current theme
const updateThemeIcon = (isDarkMode) => {
const themeMode = isDarkMode ? 'darkMode' : 'lightMode';
const iconPath = themeIcon.querySelector('use').getAttribute('href').replace(/#.*$/, `#${themeMode}`);
themeIcon.querySelector('use').setAttribute('href', iconPath);
};

// Function to update the theme based on the current mode
const updateTheme = (isDarkMode) => {
const theme = isDarkMode ? 'dark' : 'light';
document.documentElement.setAttribute('data-theme', theme);
updateThemeIcon(isDarkMode);
};

// Function to toggle the theme
const toggleTheme = () => {
const isDarkMode = toggleButton.checked;
updateTheme(isDarkMode);
themeSound.play();
localStorage.setItem('theme', isDarkMode ? 'dark' : 'light');

// Add transition class to body for smooth transition
document.body.classList.add('theme-transition');
setTimeout(() => {
document.body.classList.remove('theme-transition');
}, 300);
};

// Event listener for theme toggle
toggleButton.addEventListener('change', toggleTheme);

// Function to initialize the theme based on the stored preference
const initializeTheme = () => {
const storedTheme = localStorage.getItem('theme');
const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
const isDarkMode = storedTheme === 'dark' || (!storedTheme && prefersDark);
toggleButton.checked = isDarkMode;
updateTheme(isDarkMode);
};

// Initialize the theme
initializeTheme();

// Listen for changes in system preference
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', initializeTheme);
53 changes: 53 additions & 0 deletions templates/atom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="{{ lang }}">
<title>{{ config.title }}
{%- if term %} - {{ term.name }}
{%- elif section.title %} - {{ section.title }}
{%- endif -%}
</title>
{%- if config.description %}
<subtitle>{{ config.description }}</subtitle>
{%- endif %}
<link rel="self" type="application/atom+xml" href="{{ feed_url | safe }}"/>
<link rel="alternate" type="text/html" href="
{%- if section -%}
{{ section.permalink | escape_xml | safe }}
{%- else -%}
{{ config.base_url | escape_xml | safe }}
{%- endif -%}
"/>
<generator uri="https://www.getzola.org/">Zola</generator>
<updated>{{ last_updated | date(format="%+") }}</updated>
<id>{{ feed_url | safe }}</id>
{%- for page in pages %}
<entry xml:lang="{{ page.lang }}">
<title>{{ page.title }}</title>
<published>{{ page.date | date(format="%+") }}</published>
<updated>{{ page.updated | default(value=page.date) | date(format="%+") }}</updated>
{% for author in page.authors %}
<author>
<name>
{{ author }}
</name>
</author>
{% else %}
<author>
<name>
{%- if config.author -%}
{{ config.author }}
{%- else -%}
Unknown
{%- endif -%}
</name>
</author>
{% endfor %}
<link rel="alternate" type="text/html" href="{{ page.permalink | safe }}"/>
<id>{{ page.permalink | safe }}</id>
{% if page.summary %}
<summary type="html">{{ page.summary }}</summary>
{% else %}
<content type="html" xml:base="{{ page.permalink | escape_xml | safe }}">{{ page.content }}</content>
{% endif %}
</entry>
{%- endfor %}
</feed>

0 comments on commit e18f4ec

Please sign in to comment.