\documentclass[DIV=13,%
               BCOR=0mm,%
               headinclude=false,%
               footinclude=false,open=any,%
               fontsize=10pt,%
               oneside,%
               paper=a5]%
               {scrbook}






\usepackage[noautomatic]{imakeidx}



\usepackage{microtype}
\usepackage{graphicx}
\usepackage{alltt}
\usepackage{verbatim}
\usepackage[shortlabels]{enumitem}
\usepackage{tabularx}
\usepackage[normalem]{ulem}
\def\hsout{\bgroup \ULdepth=-.55ex \ULset}
% https://tex.stackexchange.com/questions/22410/strikethrough-in-section-title
% Unclear if \protect \hsout is needed. Doesn't looks so
\DeclareRobustCommand{\sout}[1]{\texorpdfstring{\hsout{#1}}{#1}}
\usepackage{wrapfig}

% avoid breakage on multiple <br><br> and avoid the next [] to be eaten
\newcommand*{\forcelinebreak}{\strut\\*{}}

\newcommand*{\hairline}{%
  \bigskip%
  \noindent \hrulefill%
  \bigskip%
}

% reverse indentation for biblio and play

\newenvironment*{amusebiblio}{
  \leftskip=\parindent
  \parindent=-\parindent
  \smallskip
  \indent
}{\smallskip}

\newenvironment*{amuseplay}{
  \leftskip=\parindent
  \parindent=-\parindent
  \smallskip
  \indent
}{\smallskip}

\newcommand*{\Slash}{\slash\hspace{0pt}}


% http://tex.stackexchange.com/questions/3033/forcing-linebreaks-in-url
\PassOptionsToPackage{hyphens}{url}\usepackage[hyperfootnotes=false,hidelinks,breaklinks=true]{hyperref}
\usepackage{bookmark}

\usepackage[english,shorthands=off]{babel}
\babelfont{rm}[Path=/usr/share/texmf/fonts/opentype/public/tex-gyre/,%
 BoldFont=texgyrepagella-bold.otf,%
 BoldItalicFont=texgyrepagella-bolditalic.otf,%
 ItalicFont=texgyrepagella-italic.otf]{texgyrepagella-regular.otf}
\babelfont{tt}[Scale=MatchLowercase,%
 Path=/usr/share/fonts/truetype/cmu/,%
 BoldFont=cmuntb.ttf,%
 BoldItalicFont=cmuntx.ttf,%
 ItalicFont=cmunit.ttf]{cmuntt.ttf}
\babelfont{sf}[Scale=MatchLowercase,%
 Path=/usr/share/fonts/truetype/cmu/,%
 BoldFont=cmunsx.ttf,%
 BoldItalicFont=cmunso.ttf,%
 ItalicFont=cmunsi.ttf]{cmunss.ttf}



\renewcommand*{\partpagestyle}{empty}


% global style

\pagestyle{plain}




\usepackage{indentfirst}

% remove the numbering
\setcounter{secnumdepth}{-2}

% remove labels from the captions
\renewcommand*{\captionformat}{}
\renewcommand*{\figureformat}{}
\renewcommand*{\tableformat}{}
\KOMAoption{captions}{belowfigure,nooneline}
\addtokomafont{caption}{\centering}







\deffootnote[3em]{0em}{4em}{\textsuperscript{\thefootnotemark}~}


\addtokomafont{disposition}{\rmfamily}
\addtokomafont{descriptionlabel}{\rmfamily}


\frenchspacing
% avoid vertical glue
\raggedbottom

% this will generate overfull boxes, so we need to set a tolerance
% \pretolerance=1000
% pretolerance is what is accepted for a paragraph without
% hyphenation, so it makes sense to be strict here and let the user
% accept tweak the tolerance instead.
\tolerance=200
% Additional tolerance for bad paragraphs only
\setlength{\emergencystretch}{30pt}

% (try to) forbid widows/orphans
\clubpenalty=10000
\widowpenalty=10000





% given that we said footinclude=false, this should be safe
\setlength{\footskip}{2\baselineskip}
\setlength{\parindent}{15pt}

\title{Site customization}
\date{}
\author{}
\subtitle{}






% https://groups.google.com/d/topic/comp.text.tex/6fYmcVMbSbQ/discussion
\hypersetup{%
pdfencoding=auto,
pdftitle={Site customization},%
pdfauthor={},%
pdfsubject={},%
pdfkeywords={doc; howto}%
}


\begin{document}









  \begin{titlepage}


  \strut\vskip 2em
  \begin{center}

  {\usekomafont{title}{\huge Site customization\par}}%
  \vskip 1em
  
  \vskip 2em
  
  \vskip 1.5em



   
   \vfill



  
    \strut\par
  


  \end{center}


     \end{titlepage}
     
     \cleardoublepage





\tableofcontents
% start a new right-handed page

\cleardoublepage



\chapter{Site-wide changes}


Each site is configurable by root and admin users in the console
(\texttt{/user/site} or \texttt{admin/sites}).


However, part of the configuration should be done adding some files to
the \texttt{site\_files} directory in the \texttt{repo/SITE\_ID/} directory, which is
the git repository of the site. See \href{offline-editing-via-git}{\texttt{offline-editing-via-git}} for
the workflow's details.


If you installed Amusewiki via the
\href{https://packages.amusewiki.org}{Debian packages}, this directory is
located in \texttt{/var/lib/amusewiki/repo/SITE\_ID/site\_files} (where
\texttt{SITE\_ID} is the site code).


\begin{description}

\item[{\texttt{favicon.ico}}] 
If present, this will be used as favicon.


\item[{\texttt{local.css}}] 
Additional CSS rules. Always loaded.


\item[{\texttt{local-alt.css}}] 
Same as above, but loaded only if the alternate
theme is in use (so-called dark-mode).


\item[{\texttt{local.js}}] 
Local JS file. Here you can do whatever you want
without tampering with the code. Open an issue on
\href{https://github.com/melmothx/amusewiki/issues}{GitHub}
if you think you miss IDs in the HTML to hook on.


\item[{\texttt{navlogo.png}}] 
If present, it will be placed on the navigation bar
as logo. Height is enforced to 50px.


\item[{\texttt{navlogo-alt.png}}] 
Same as above, but used when the alternate theme is in use.


\item[{\texttt{widebanner.png}}] 
If present, it's used to place a banner below the
navbar (which is fixed). It should have a width
of 1170px for optimal results.


\item[{\texttt{pagelogo.png}}] 
If present, it will be placed before the latest
entries on the special pages. The assigned ids are
"special-pages-logo" for the container and
"special-pages-logo-img" for the image itself.


\item[{\texttt{opengraph.png}}] 
If present, it will be used for the \href{http://ogp.me/}{opengraph protocol}
(used on social networks when sharing a
link). The image opengraph.png should have
dimension 300x300 for better effect. If not
present, pagelogo.png will be used, otherwise
navlogo.png will be used, with often odd results.


\end{description}

The normal way to add these files would be to use
\href{offline-editing-via-git}{Git}, but if you place them manually in
the tree, just remember to run \texttt{amusewiki bootstrap-archive --refresh SITE\_ID}
(or \texttt{scripts/amusewiki-bootstrap-archive --refresh SITE\_ID} if not installed by .deb, from the amusewiki installation directory)

\chapter{Per-text changes}


For maximum flexibility, you should use the
\texttt{repo/SITE\_ID/site\_files/local.js} file. Every text has an API
endpoint which you can hit to get the values of the header of the text
file, regardless if the field is supported or not.


In this example, we don't want to show the body when we use in the header:


\begin{alltt}
\#hidebody 1
\#title My title

Text....
\end{alltt}


We can do this in the \texttt{local.js} file:


\begin{alltt}
\$(document).ready(function () \{
    // check if we are in a text page
    var api = \$('\#page').data('text-json-header-api');
    if (api) \{
        \$.ajax(\{
            url: api,
            dataType: 'json',
            success: function(response) \{
                // log what we get
                console.log(response);
                if (response.hidebody) \{
                    \$('.page-header').remove();
                    \$('\#htmltextbody').remove();
                \}
            \}
        \});
    \}
\});
\end{alltt}


If the changes don't show up immediately try first to force reload the
browser, there is probably cache, while if the file is not loaded at
all, try to run \texttt{amusewiki bootstrap-archive --refresh SITE\_ID} again.









% begin final page

\clearpage



% new page for the colophon

\thispagestyle{empty}

\begin{center}





\bigskip
\includegraphics[width=0.25\textwidth]{logo-amw.pdf}
\bigskip

\end{center}

\strut

\vfill

\begin{center}




Site customization






\bigskip



   

       

       

       

       

       

       

   



\bigskip
\textbf{amusewiki.org}


\end{center}

% end final page with colophon


% end closing pages



\end{document}


% No format ID passed.



