script js pour recherche par moteur externe
This commit is contained in:
parent
530b8b7553
commit
c20b6a1b4d
@ -207,6 +207,8 @@ for website_name in "${blogs_folders[@]}"; do
|
||||
|
||||
# copier le style dans le dossier html
|
||||
cp $style_file html-websites/$website_name/style.css
|
||||
# copier le script permettant la recherche
|
||||
cp templates/js/main_script.js html-websites/$website_name/main_script.js
|
||||
|
||||
# traiter les réductions d'images dans l'inbox
|
||||
python3 pictures_resize.py
|
||||
|
@ -72,6 +72,7 @@ def enrich_one_file(html_content: str, partials: dict = {"header_page": "", "foo
|
||||
<meta property="og:site_name" content="{template_content['TITLE']}">
|
||||
<link rel="alternate" type="application/rss+xml" title="Cipher Bliss » Flux" href="{template_content['NDD']}/feed/">
|
||||
<link href="/style.css" rel="stylesheet">
|
||||
<script src="main_script.js"></script>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>{template_content['TITLE']}</title>
|
||||
@ -102,7 +103,7 @@ def enrich_one_file(html_content: str, partials: dict = {"header_page": "", "foo
|
||||
<nav class="navbar is-fixed-top is-dark" role="navigation" aria-label="main navigation">
|
||||
<div class="navbar-brand">
|
||||
<a class="navbar-item" href="{template_content['NDD']}">
|
||||
Accueil
|
||||
{template_content['NDD']}
|
||||
</a>
|
||||
</div>
|
||||
|
||||
@ -116,7 +117,7 @@ def enrich_one_file(html_content: str, partials: dict = {"header_page": "", "foo
|
||||
</div>
|
||||
<div class="navbar-end">
|
||||
<div class="navbar-item">
|
||||
<form role="search" method="get" class="search-form" action="/">
|
||||
<form role="search" method="get" class="search-form" action="/" id="recherche">
|
||||
<label>
|
||||
<input class="search-field" placeholder="Recherche" value="" name="s"
|
||||
type="search">
|
||||
@ -140,7 +141,6 @@ def enrich_one_file(html_content: str, partials: dict = {"header_page": "", "foo
|
||||
<div class="container">
|
||||
<div class="site-footer-inner">
|
||||
<div class="site-foot">
|
||||
|
||||
</div>
|
||||
<nav class="footer-nav">
|
||||
{template_content['NAVIGATION']}
|
||||
|
@ -67,7 +67,7 @@ def add_tags_from_content(tags=None, file_content="", words_to_check=None):
|
||||
return tags
|
||||
|
||||
|
||||
def extract_tags_from_file(file_path, excluded_tags, count_not_tagged_files=0):
|
||||
def extract_tags_from_file(file_path, excluded_tags):
|
||||
tags = set()
|
||||
with open(file_path, 'r', encoding='utf-8') as file_content:
|
||||
tag_found = False
|
||||
@ -91,7 +91,6 @@ def extract_tags_from_file(file_path, excluded_tags, count_not_tagged_files=0):
|
||||
tag_found = True
|
||||
|
||||
if not tag_found:
|
||||
count_not_tagged_files += 1
|
||||
print('no tag in the article', file_path)
|
||||
return tags
|
||||
|
||||
@ -99,7 +98,7 @@ def extract_tags_from_file(file_path, excluded_tags, count_not_tagged_files=0):
|
||||
def group_files_by_tags(org_files, excluded_tags):
|
||||
tag_to_files = defaultdict(set)
|
||||
for file_path in org_files:
|
||||
tags = extract_tags_from_file(file_path, excluded_tags, count_not_tagged_files)
|
||||
tags = extract_tags_from_file(file_path, excluded_tags)
|
||||
for tag in tags:
|
||||
tag_to_files[tag].add(file_path)
|
||||
return tag_to_files
|
||||
@ -215,4 +214,4 @@ if __name__ == "__main__":
|
||||
|
||||
print(f"Tags et fichiers associés ont été enregistrés dans {output_file}")
|
||||
print(f"Pages HTML générées dans {html_output_folder}")
|
||||
print(f"Pages non tagguées: {count_not_tagged_files}")
|
||||
# print(f"Pages non tagguées: {count_not_tagged_files}") # TODO
|
||||
|
@ -149,11 +149,22 @@ ul {
|
||||
li {
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
#tags_page li {
|
||||
display: inline;
|
||||
}
|
||||
li a {
|
||||
display: inline-block;
|
||||
margin-right: 1em;
|
||||
}
|
||||
|
||||
#title-block-header {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.navbar-start > .navbar-item {
|
||||
float: left;
|
||||
}
|
||||
|
||||
.navbar-menu img {
|
||||
width: 2rem;
|
||||
height: 2rem;
|
||||
|
@ -149,11 +149,22 @@ ul {
|
||||
li {
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
#tags_page li {
|
||||
display: inline;
|
||||
}
|
||||
li a {
|
||||
display: inline-block;
|
||||
margin-right: 1em;
|
||||
}
|
||||
|
||||
#title-block-header {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.navbar-start > .navbar-item {
|
||||
float: left;
|
||||
}
|
||||
|
||||
.navbar-menu img {
|
||||
width: 2rem;
|
||||
height: 2rem;
|
||||
|
16
templates/js/main_script.js
Normal file
16
templates/js/main_script.js
Normal file
@ -0,0 +1,16 @@
|
||||
// search bar to send a request to a search engine for the current domain when sent
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
// Obtient le nom de domaine de la page courante
|
||||
const currentDomain = window.location.hostname;
|
||||
const form = document.getElementById('recherche');
|
||||
|
||||
// Ajoute un écouteur d'événement pour l'événement 'submit'
|
||||
form.addEventListener('submit', function(event) {
|
||||
// Empêche le comportement par défaut du formulaire
|
||||
event.preventDefault()
|
||||
const query = document.getElementById('query').value
|
||||
const url = `https://duckduckgo.com/?q=${encodeURIComponent(query)}+site%3A${encodeURIComponent(currentDomain)}`;
|
||||
|
||||
window.location.href = url;
|
||||
});
|
||||
});
|
@ -149,11 +149,22 @@ ul {
|
||||
li {
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
#tags_page li {
|
||||
display: inline;
|
||||
}
|
||||
li a {
|
||||
display: inline-block;
|
||||
margin-right: 1em;
|
||||
}
|
||||
|
||||
#title-block-header {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.navbar-start > .navbar-item {
|
||||
float: left;
|
||||
}
|
||||
|
||||
.navbar-menu img {
|
||||
width: 2rem;
|
||||
height: 2rem;
|
||||
|
@ -1 +1 @@
|
||||
{"version":3,"sourceRoot":"","sources":["../styles_src/style_general.scss"],"names":[],"mappings":";AAAA;AACA;EACE;EACA;EACA;;;AAGF;EACE;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;;;AAGF;AAAA;AAAA;AAAA;EAIE;EACA;;;AAGF;AAAA;AAAA;AAAA;AAAA;AAAA;EAME;EACA;EACA;EACA;;;AAGF;AAEA;EACE;;AAEA;EAEE;;;AAIJ;EACE;EACA;EACA;EACA;;;AAGF;AAGI;AAAA;AAAA;AAAA;AAAA;EAKE;EACA;EACA;EACA;EACA;;;AAGN;EACE;;;AAIF;EACE;EAEA;EACA;EACA;;AAEA;EACE;EACA;;AAIF;EAEI;EACA;EACA;EACA;;;AAIN;AAAA;AAAA;AAAA;EAIE;;;AAEF;EACI;EACF;EACA;EACA;;;AAGF;EACE;EACA;EACA;;;AAGF;EACE;EACA;;;AAGF;EACE;EACA;;;AAGF;AAAA;AAAA;AAAA;AAAA;AAAA;EAMI;EACF;EACA;;;AAGF;AAAA;EAEE;;;AAGF;AAAA;AAAA;AAAA;EAIE;;;AAGF;EACE;EACA;;;AAGF;EACE;;;AAIF;EACE;;;AAIA;EAEE;EACA;EACA;;;AAIJ;EACE;;AACA;EACE;EACA;EACA;EACA;EACA;;;AAGJ;EACE;;;AAEF;AAAA;EAEE;;;AAIF;EACI;;;AAGJ;EACI;EACA;EACA;EACA;;;AAGJ;EACE;;;AAGF;EACE;EACA;EACA;EACA;;;AAIF;EACE;IACE;;EAEF;IACE","file":"style_general.css"}
|
||||
{"version":3,"sourceRoot":"","sources":["../styles_src/style_general.scss"],"names":[],"mappings":";AAAA;AACA;EACE;EACA;EACA;;;AAGF;EACE;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;;;AAGF;AAAA;AAAA;AAAA;EAIE;EACA;;;AAGF;AAAA;AAAA;AAAA;AAAA;AAAA;EAME;EACA;EACA;EACA;;;AAGF;AAEA;EACE;;AAEA;EAEE;;;AAIJ;EACE;EACA;EACA;EACA;;;AAGF;AAGI;AAAA;AAAA;AAAA;AAAA;EAKE;EACA;EACA;EACA;EACA;;;AAGN;EACE;;;AAIF;EACE;EAEA;EACA;EACA;;AAEA;EACE;EACA;;AAIF;EAEI;EACA;EACA;EACA;;;AAIN;AAAA;AAAA;AAAA;EAIE;;;AAEF;EACI;EACF;EACA;EACA;;;AAGF;EACE;EACA;EACA;;;AAGF;EACE;EACA;;;AAGF;EACE;EACA;;;AAGF;AAAA;AAAA;AAAA;AAAA;AAAA;EAMI;EACF;EACA;;;AAGF;AAAA;EAEE;;;AAGF;AAAA;AAAA;AAAA;EAIE;;;AAGF;EACE;EACA;;;AAGF;EACE;;AACA;EACI;;AAEJ;EACI;EACA;;;AAKN;EACE;;;AAGF;EAEI;;;AAKF;EAEE;EACA;EACA;;;AAIJ;EACE;;AACA;EACE;EACA;EACA;EACA;EACA;;;AAGJ;EACE;;;AAEF;AAAA;EAEE;;;AAIF;EACI;;;AAGJ;EACI;EACA;EACA;EACA;;;AAGJ;EACE;;;AAGF;EACE;EACA;EACA;EACA;;;AAIF;EACE;IACE;;EAEF;IACE","file":"style_general.css"}
|
@ -157,13 +157,30 @@ ul {
|
||||
|
||||
li {
|
||||
margin-bottom: 1em;
|
||||
#tags_page & {
|
||||
display:inline;
|
||||
}
|
||||
a{
|
||||
display:inline-block;
|
||||
margin-right: 1em;
|
||||
}
|
||||
}
|
||||
|
||||
// balise crée par pandoc
|
||||
#title-block-header {
|
||||
display: none;
|
||||
}
|
||||
.navbar-brand{
|
||||
display:blog;
|
||||
text-align: left;
|
||||
}
|
||||
.navbar-start{
|
||||
> .navbar-item{
|
||||
|
||||
float:left;
|
||||
|
||||
}
|
||||
}
|
||||
.navbar-menu {
|
||||
img {
|
||||
|
||||
|
@ -35,8 +35,9 @@ configs_sites = {
|
||||
<a href="/">Accueil</a>
|
||||
<a href="https://portfolio.cipherbliss.com">Portfolio</a>
|
||||
<a href="/feed">Flux RSS</a>
|
||||
<a href="/contact">Contact</a>
|
||||
<a href="/ressources-de-café-vie-privée">Ressources</a>
|
||||
<a href="/tags">Tags</a>
|
||||
<a href="/contact">Contact</a>
|
||||
</nav>
|
||||
""",
|
||||
"BANNIERE_ENTETE": "https://www.cipherbliss.com/wp-content/uploads/2016/11/bg.jpg",
|
||||
@ -65,6 +66,7 @@ configs_sites = {
|
||||
<a href="https://www.cipherbliss.com">Cipherbliss</a>
|
||||
<a href="/feed">Flux RSS</a>
|
||||
<a href="https://cloud.tykayn.fr/index.php/s/dessins_partage_blog">Sources des illustrations</a>
|
||||
<a href="/tags">Tags</a>
|
||||
<a href="/contact">Contact</a>
|
||||
</nav>
|
||||
""",
|
||||
|
Loading…
Reference in New Issue
Block a user