Skip to content

Commit

Permalink
Blog subsection on site (#282)
Browse files Browse the repository at this point in the history
* Cleanup for blog section

* Some sbt config to generate blog post data

* Blog index generation

* Simplify blog listing

* Remove blog from left navigation

* Some cleanup

* Site structure update to include to blog posts

It is quite important to allow for easy blog contributions and the
shared information that these entries can provide. As a result, the
needed html structure changes have been added to allow for this
section of the website to now be added and extended.

Fixes #270
  • Loading branch information
gpampara committed May 14, 2018
1 parent 2ec20eb commit 1521309
Show file tree
Hide file tree
Showing 17 changed files with 310 additions and 82 deletions.
3 changes: 3 additions & 0 deletions .envrc
@@ -0,0 +1,3 @@
export SBT_OPTS="-Xmx2G -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled -Xss2M -Duser.timezone=GMT"

use nix
4 changes: 2 additions & 2 deletions CHANGELOG.md
Expand Up @@ -14,12 +14,12 @@ algorithms.
Given that this is the first release of the library, what follows is a
general description of the main features within the library. For usage
details and examples, please consult either the project
[website](http://cilib.net), the _examples_ directory in the project
[website](https://cilib.net), the _examples_ directory in the project
source, or the community created [tutorial
book](https://github.com/cirg-up/cilib-tutorial/releases/latest)

For more information, please consult the
[scaladoc](http://cilib.net/api/cilib/index.html) and come join the
[scaladoc](https://cilib.net/api/cilib/index.html) and come join the
community on [gitter.im](https://gitter.im/cirg-up/cilib)

#### Controlled Randomness
Expand Down
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Expand Up @@ -123,14 +123,14 @@ This document is heavily based on the [Cats contributor's guide].
[create a GitHub issue]: https://github.com/cirg-up/cilib/issues/new
[Github pull requests]: https://help.github.com/articles/about-pull-requests/
[sbt]: http://www.scala-sbt.org/0.13/tutorial/Setup.html
[Gitter]: http://gitter.im/cirg-up/cilib
[Gitter]: https://gitter.im/cirg-up/cilib
[The documentation]: https://cirg-up.github.io/cilib
[docs subproject]: https://github.com/cirg-up/cilib/tree/master/docs/
[master]: https://github.com/cirg-up/cilib/tree/master
[series-1.0.x]: https://github.com/cirg-up/cilib/tree/series/1.0.x
[Apache-2.0 License]: https://github.com/cirg-up/cilib/blob/master/LICENSE
[add yourself as an adopter]: https://github.com/cirg-up/cilib/edit/master/docs/src/hugo/content/adopters.md
[adopters list]: http://cirg-up.github.io/cilib/adopters/
[adopters list]: https://cirg-up.github.io/cilib/adopters/
[GitHub issues]: https://github.com/cirg-up/cilib/issues
[community staff]: http://cirg-up.github.io/cilib/community/conduct.html#community-staff
[community staff]: https://cirg-up.github.io/cilib/community/conduct.html#community-staff
[Cats contributor's guide]: https://github.com/typelevel/cats/blob/master/CONTRIBUTING.md
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -23,8 +23,8 @@ intelligence algorithms and uses several typeclasses such as `Functor` and

## Documentation and Support

* Have a look a the [website](http://cilib.net)
* [scaladoc](http://cilib.net/api/cilib)
* Have a look a the [website](https://cilib.net)
* [scaladoc](https://cilib.net/api/cilib)
* The source code of the project also contains several examples, have
a look in the `example` directory
* If you run into trouble, please open an issue
Expand Down
18 changes: 10 additions & 8 deletions build.sbt
Expand Up @@ -111,8 +111,8 @@ lazy val noPublishSettings = Seq(
)

lazy val publishSettings = Seq(
organizationHomepage := Some(url("http://github.com/cirg-up")),
homepage := Some(url("http://cilib.net")),
organizationHomepage := Some(url("https://github.com/cirg-up")),
homepage := Some(url("https://cilib.net")),
licenses := Seq("Apache-2.0" -> url("https://opensource.org/licenses/Apache-2.0")),
autoAPIMappings := true,
apiURL := Some(url("https://cilib.net/api/")),
Expand Down Expand Up @@ -140,7 +140,7 @@ lazy val publishSettings = Seq(
<developer>
<id>{id}</id>
<name>{name}</name>
<url>http://github.com/{id}</url>
<url>https://github.com/{id}</url>
</developer>
}
}
Expand Down Expand Up @@ -246,17 +246,19 @@ lazy val docSettings = Seq(
siteStageDirectory := target.value / "site-stage",
sourceDirectory in paradox in Paradox := siteStageDirectory.value,
sourceDirectory in paradox := siteStageDirectory.value,
// https://github.com/lightbend/paradox/issues/139
sourceDirectory in Paradox in paradoxTheme := sourceDirectory.value / "main" / "paradox" / "_template",
paradoxMaterialTheme in Paradox ~= {
_.withFavicon("img/favicon.png")
.withLogo("img/cilib_logo_transparent.png")
.withRepository(uri("https://github.com/cirg-up/cilib"))
},
paradoxProperties in Compile ++= Map(
"github.base_url" -> s"https://github.com/cirg-up/cilib/tree/series/2.0.x/${version.value}"
),
copySiteToStage := {
IO.copyDirectory(source = sourceDirectory.value / "main" / "paradox",
target = siteStageDirectory.value,
IO.copyFile(sourceFile = sourceDirectory.value / "main" / "paradox" / "index.md",
targetFile = siteStageDirectory.value / "index.md",
preserveLastModified = true)
IO.copyDirectory(source = sourceDirectory.value / "main" / "paradox" / "img",
target = siteStageDirectory.value / "img",
overwrite = false,
preserveLastModified = true)
IO.copyDirectory(source = tutTargetDirectory.value,
Expand Down
162 changes: 162 additions & 0 deletions docs/src/main/paradox/_template/blog.st
@@ -0,0 +1,162 @@
$!
Copyright (c) 2016-2017 Martin Donath <martin.donath@squidfunk.com>
Copyright (c) 2017 Jonas Fonseca <jonas.fonseca@gmail.com>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
!$
<!DOCTYPE html>
<html lang="$page.properties.("material.language"); null="en"$" class="no-js">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="description" content="$page.properties.("project.description")$">
<meta name="generator" content="Paradox, paradox-material-theme=$page.properties.("material.theme.version")$, mkdocs-material=2.2.2">
$partials/language()$
$ if (page.properties.("description")) $
<meta name="description" content="$page.properties.("description")$">
$ elseif (page.properties.("project.description")) $
<meta name="description" content="$page.properties.("project.description")$">
$ endif $
$ if (page.properties.("material.canonical.url")) $
<link rel="canonical" href="$page.properties.("material.canonical.url")$">
$ endif $
$ if (page.properties.("author")) $
<meta name="author" content="$page.properties.("author")$">
$ elseif (page.properties.("material.author")) $
<meta name="author" content="$page.properties.("site.author")$">
$ endif $
<link rel="shortcut icon" href="$page.base$$page.properties.("material.favicon")$">
$ if (page.properties.("title")) $
<title>$page.properties.("title")$</title>
$ elseif (page.title) $
<title>$page.title$$ if (!page.home.active) $ · $page.home.title$$ endif $</title>
$ else $
<title>$page.home.title$</title>
$ endif $
<link rel="stylesheet" href="$page.base$assets/stylesheets/application.7a4cdee3.css">
$ if (page.properties.("material.color.primary")) $
<link rel="stylesheet" href="$page.base$assets/stylesheets/application-palette.792431c1.css">
$ endif $
<link rel="stylesheet" href="$page.base$lib/material__tabs/dist/mdc.tabs.min.css">
<link rel="stylesheet" href="$page.base$lib/prettify/prettify.css">
<script src="$page.base$lib/modernizr/modernizr.min.js"></script>
$ if (page.properties.("material.font.text")) $
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=$page.properties.("material.font.text.url")$:300,400,400i,700|$page.properties.("material.font.code.url")$">
<style>
body,input{font-family:"$page.properties.("material.font.text")$","Helvetica Neue",Helvetica,Arial,sans-serif}
code,kbd,pre{font-family:"$page.properties.("material.font.code")$","Courier New",Courier,monospace}
</style>
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
$ endif $
<link rel="stylesheet" href="$page.base$assets/stylesheets/paradox-material-theme.css">
$ if (page.properties.("material.custom.stylesheet")) $
<link rel="stylesheet" href="$page.base$$page.properties.("material.custom.stylesheet")$">
$ endif $
</head>
<body
$ if (page.properties.("material.color.primary")) $
data-md-color-primary="$page.properties.("material.color.primary")$"
$ endif $
$ if (page.properties.("material.color.accent")) $
data-md-color-accent="$page.properties.("material.color.accent")$"
$ endif $
>
<input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="drawer">
<input class="md-toggle" data-md-toggle="search" type="checkbox" id="search">
<label class="md-overlay" data-md-component="overlay" for="drawer"></label>
$partials/header()$
<div class="md-container">
$ if (page.properties.("material.hero")) $
$partials/hero()$
$ endif $
<main class="md-main">
<div class="md-main__inner md-grid" data-md-component="container">
<div class="md-sidebar md-sidebar--primary" data-md-component="navigation">
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
$partials/blog_nav()$
</div>
</div>
</div>
$ if (page.subheaders) $
<div class="md-sidebar md-sidebar--secondary" data-md-component="toc">
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
$partials/toc()$
</div>
</div>
</div>
$ endif $
<div class="md-content">
<article class="md-content__inner md-typeset">
<div class="md-content__searchable">
$page.content$
</div>
$ if (page.source_url) $
<div>
<a href="$page.source_url$" title="Edit this page" class="md-source-file md-edit">
Edit this page
</a>
</div>
$ endif $
<div class="print-only">
<span class="md-source-file md-version">
$page.properties.("project.version.short")$
</span>
</div>
</article>
</div>
</div>
</main>
$partials/footer()$
</div>
<script src="$page.base$assets/javascripts/application.5165553b.js"></script>
<script src="$page.base$assets/javascripts/paradox-material-theme.js"></script>
$!
The ending "." enables search to work without providing the site URL, since the
theme JavaScript fetches the index by concatenating the base URL to an absolute
path: "/search/search_index.json".
It originally was "./" but this breaks previewSite because it leads to a double
slash when fetching the index, i.e. ".//search/...". To complete the workaround
all locations in the search index now start with a "/" so the JavaScript can
safely do: `url.base + doc.location`.
!$
<script>app.initialize({version:"0.17",url:{base:"$page.base$."}})</script>
<script type="text/javascript" src="$page.base$lib/prettify/prettify.js"></script>
<script type="text/javascript" src="$page.base$lib/prettify/lang-scala.js"></script>
<script type="text/javascript">
document.addEventListener("DOMContentLoaded", function(event) {
window.prettyPrint && prettyPrint();
});
</script>
$ if (page.properties.("material.custom.javascript")) $
<script src="$page.base$$page.properties.("material.custom.javascript")$"></script>
$ endif $
$ if (page.properties.("material.google.analytics")) $
$partials/integrations/analytics()$
$ endif $
</body>
</html>
55 changes: 55 additions & 0 deletions docs/src/main/paradox/_template/partials/blog_nav.st
@@ -0,0 +1,55 @@
$!
Copyright (c) 2016-2017 Martin Donath <martin.donath@squidfunk.com>
Copyright (c) 2017 Jonas Fonseca <jonas.fonseca@gmail.com>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
!$
<nav class="md-nav md-nav--primary" data-md-level="0" style="visibility: hidden">
<label class="md-nav__link" style="padding-left: 12px; margin-top: 0">
<a href="$page.base$index.html" title="CIlib">
CIlib
</a>
</label>
<label class="md-nav__title md-nav__title--site" for="drawer" style="margin-top: 8.75px">
<span class="md-nav__button md-logo">
$ if (page.properties.("material.logo.icon")) $
<i class="md-icon">$page.properties.("material.logo.icon")$</i>
$ else $
<img src="$page.base$$page.properties.("material.logo")$" width="24" height="24">
$endif$
</span>
<a href="$page.home.href$" title="$page.home.title$">
$page.home.title$
</a>
</label>
$ if (page.properties.("material.repo")) $
<div class="md-nav__source">
$source()$
</div>
$ endif $
<label class="md-nav__link" style="padding-left: 12px; padding-bottom: 14px">
<a href="$page.base$api/cilib" target="_blank">API</a>
</label>
$page.groups$
$page.navigation$
$toc()$
<div class="md-nav__title--site md-version" title="Version">
<i class="md-icon">label_outline</i> $page.properties.("project.version.short")$
</div>
</nav>
55 changes: 55 additions & 0 deletions docs/src/main/paradox/_template/partials/nav.st
@@ -0,0 +1,55 @@
$!
Copyright (c) 2016-2017 Martin Donath <martin.donath@squidfunk.com>
Copyright (c) 2017 Jonas Fonseca <jonas.fonseca@gmail.com>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
!$
<nav class="md-nav md-nav--primary" data-md-level="0" style="visibility: hidden">
<label class="md-nav__title md-nav__title--site" for="drawer">
<span class="md-nav__button md-logo">
$ if (page.properties.("material.logo.icon")) $
<i class="md-icon">$page.properties.("material.logo.icon")$</i>
$ else $
<img src="$page.base$$page.properties.("material.logo")$" width="24" height="24">
$endif$
</span>
<a href="$page.home.href$" title="$page.home.title$">
$page.home.title$
</a>
</label>
$ if (page.properties.("material.repo")) $
<div class="md-nav__source">
$source()$
</div>
$ endif $
<label class="md-nav__link" style="padding-left: 12px">
<a href="$page.base$blog/index.html" title="Blog">
Blog
</a>
</label>
<label class="md-nav__link" style="padding-left: 12px; padding-bottom: 14px">
<a href="$page.base$api/cilib" target="_blank">API</a>
</label>
$page.groups$
$page.navigation$
$toc()$
<div class="md-nav__title--site md-version" title="Version">
<i class="md-icon">label_outline</i> $page.properties.("project.version.short")$
</div>
</nav>
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 1 addition & 5 deletions docs/src/main/paradox/index.md
Expand Up @@ -28,12 +28,8 @@ constructed.

* Come join in the discussion in `#cilib` on `FreeNode`, or join the
[Gitter channel](https://gitter.im/cirg-up/cilib)
* [scaladoc](http://cilib.net/api/cilib)
* [scaladoc](https://cilib.net/api/cilib)
* The source code of the project also contains several examples, have
a look in the @github[example](/example/src/main/scala/cilib/example)
directory
* If you run into trouble, please open an issue


CIlib is maintained by several individuals and supported by CIRG @ UP
(Computational Intelligence Research Group @ University of Pretoria).

0 comments on commit 1521309

Please sign in to comment.