How can I have Wintersmith generate a static site with a blog in a subdirectory? - static-site

I'm looking into Wintersmith-ifying my site, which is currently hand-written. I have a couple pages: index.html, projects.html, gpg.html, etc. I want to have a blog/ subdirectory, so that the final site looks like this:
.
|- index.html
|- gpg.html
|- project.html
|- blog/
| |- look-a-new-wintersmith-blog.md
| |- monkeys-are-really-cool.md
Is this possible? I've searched and looked at the Wintersmith documentation (and even the featured Wintersmith-powered sites), and come up with nothing. It seems like the only way is to have two instances of Wintersmith or something, but it also seems like there must be a better way.

You should get the desired result with something like this:
├── config.json <- site configuration
├── contents
│ ├── index.html <- these will just be outputted as-is
│ ├── gpg.html
│ ├── project.html
│ ├── blog <– each article has its own directory
│ │ ├── index.json <- this is your blog index at /blog/index.html
│ │ ├── look-a-new-wintersmith-blog
│ │ │ └── index.md
│ │ └── monkeys-are-really-cool
│ │ └── index.md
│ ├── authors <- author metadata, check author.jade
│ │ └── the-wintersmith.json
│ ├── css
│ │ └── main.css
│ └── feed.json
├── plugins
│ └── paginator.coffee <- paginator plugin
├── templates
│ ├── archive.jade
│ ├── article.jade
│ ├── author.jade
│ ├── feed.jade
│ ├── index.jade
│ └── layout.jade
└── views
└── articles.coffee <- view that lists articles
index.json is just a renamed and moved archive.json to give a /blog/index.html URL instead. If you want the default Wintersmith index instead of an archive layout, edit the file to use the index.jade layout instead of archive.jade.
If you change your current HTML files to Markdown and put them in the same spot, then they'll be outputted as HTML as your blog posts would.
You might want to add some sort of navigation menu to your article layout, too.
Edit: To create a static page, create a Markdown file in contents similar to the following:
---
title: GPG
author: baker
date: 2014-03-23
template: article.jade
---
Content
If you named this file gpg.md, it should be accessible at http://localhost:8080/gpg.html. Because we used the article.jade template, it expects an author and a date field for completeness (it would work without, however it would still include "Written by" without an author), but you could make a custom template that doesn't use those fields.

Related

take the structure of any project

I have seen the project structure on readMe, how can I take this structure of my project, any program? any website. doesn't seems right to me to create by hand?
Yes, there is a very simple way to get it.
Navigate to the root folder of your project and run tree from your terminal. You should get something like this:
project_root
│ README.md
│
└───some_folder
│ │ another_file.txt
│ │ some_code.code
│ │
│ └───some_subfolder
│ │ some_more_code.txt
│ │ another_file.txt
│ │ a_picture.png
│ │ ...
│
└───another_folder
│ more_files.txt
│ more_code.code
...
Now you can copy and paste this tree into your README file, wrapping it in triple backticks - ``` to get the markdown styling.
https://ascii-tree-generator.com/ --> by hand ***
or ***
tree command in powershell --> auto

What does FindPackageHandleStandardArgs do exactly?

I am trying to write a Find Module for a package that I have installed. But I am having trouble understanding the CMake functions.
Here is a snippet of my code.
find_package(PkgConfig)
pkg_check_modules(PC_zcm QUIET zcm)
find_path(zcm_INCLUDE_DIR
NAMES zcm.h
PATHS $ENV{PATH}
)
mark_as_advanced(zcm_FOUND zcm_INCLUDE_DIR)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(zcm DEFAULT_MSG
REQUIRED_VARS zcm_INCLUDE_DIR
)
find_path() is able to find my zcm_INCLUDE_DIR just fine: /usr/bin/zcm/usr/local/include
But find_package_handle_standard_args() gives
-- Could NOT find zcm (missing: REQUIRED_VARS)
My directory tree looks like this:
└── zcm
├── eventlog.h
├── json
│   ├── json-forwards.h
│   └── json.h
├── message_tracker.hpp
├── tools
│   ├── IndexerPlugin.hpp
│   └── TranscoderPlugin.hpp
├── transport
│   └── generic_serial_transport.h
├── transport.h
├── transport_register.hpp
├── transport_registrar.h
├── url.h
├── util
│   └── Filter.hpp
├── zcm-cpp-impl.hpp
├── zcm-cpp.hpp
├── zcm.h
└── zcm_coretypes.h
My understanding is find_package_handle_standard_args() attempts to find the package at the path, which sounds like it would be straightforward as the path is already determined.
As for REQUIRED_VARS the docs just say "Specify the variables which are required for this package." Which doesn't tell much for a noobie like me.
Description of find_package_handle_standard_args notes about two signatures of given function, one signature accepts DEFAULT_MSG option and another one accepts REQUIRED_VARS option.
You are trying to mix these signatures, and this is wrong.
Proper usage of the first signature:
# Everything after DEFAULT_MSG is treated as required variable.
find_package_handle_standard_args(zcm DEFAULT_MSG
zcm_INCLUDE_DIR
)
Proper usage of the second signature:
# By default, the standard error message is used.
find_package_handle_standard_args(zcm REQUIRED_VARS
zcm_INCLUDE_DIR
)

Modern CMake - setup libraries targets inside project

My project structure presents as follows:
── src
├── app
│ ├── first_app
│ │ ├── include
│ │ └── src
│ │ └── CMakeLists.txt
│ ├── second_app
│ │ └── ...
├── lib
│ ├── first_lib
│ | ├── include
│ | └── src
│ | └── CMakeLists.txt
│ ├── second_lib
│ | ├── include
│ | └── src
│ | └── CMakeLists.txt
├── CMakeLists.txt
first_app uses both first_lib and second_lib. I would like to force CMake to find all dependencies (libraries and include headers) using
target_link_libraries(first_app first_lib::first_lib second_lib::second_lib).
I would like to ask two questions:
What command should be used to export first_lib::first_lib in ./src/lib/first_lib/CMakeLists.txt?
How to make first_lib::first_lib visible in ./src/app/first_app/CMakeLists.txt?
Supposing you create your lib using add_library(first_lib ...)
1) I would use:
include(GNUInstallDirs)
install(TARGETS first_lib
EXPORT FirstLibTargets
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/first_lib
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
src: https://github.com/Mizux/cmake-cpp/blob/master/Foo/CMakeLists.txt#L24
then you can install the export file using:
install(EXPORT FirstLibTargets
NAMESPACE first_lib::
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/FirstLib
COMPONENT Devel)
src: https://github.com/Mizux/cmake-cpp/blob/master/CMakeLists.txt
note: I don't know if you can install target alias (i.e. install(TARGETS first_lib::first_lib) and/or have an export file with differents namespace (i.e. first_lib:: second_lib::)
2) simply use in first_lib/CMakeLists.txt:
add_library(first_lib::first_lib ALIAS first_lib) just after your add_library.
so first_app could always use first_lib::first-lib to retrieve this target dependencies what ever if you use a Meta CMake (i.e. add_subdirectory()) or find_package().
e.g. https://github.com/Mizux/cmake-cpp/blob/master/Foo/CMakeLists.txt

Are multiple document roots to serve the same path possible?

Is it possible to have a directory structure on an Apache server similar to this:
└── www
├── root1
│   └── doc1.html
└── root2
└── doc2.html
such that doc1.html and doc2.html are both served on the same path?
(e.g. http://localhost/doc1.html and http://localhost/doc2.html both result in successful requests?)
Do it with aliasing. See httpd.apache.org/docs/2.2/mod/mod_alias.html#alias

Correct cmake setup to include headers

I have a project structured like this:
─root
├──src
│ ├──main.cpp
│ └──CMakeLists.txt[2]
├──build
├──out
├──inc
├──dep
│ ├──log
│ │ ├──include
│ │ │ └──log.h
│ │ ├──src
│ │ │ └──log.cpp
│ │ └──CMakeLists.txt[4]
│ └──CMakeLists.txt[3]
└──CMakeLists.txt[1]
Under dep I have a logging library, which is an external git repository with his own CMakeLists.txt file.
The main CMakeLists.txt (marked as [1]) is:
cmake_minimum_required(VERSION 2.6)
set(APP_ROOT ${PROJECT_SOURCE_DIR})
add_subdirectory(dep)
add_subdirectory(src)
The CMakeLists.txt (marked as [2]) for the current project code is:
add_executable(app main.cpp)
target_link_libraries(app log)
include_directories("${APP_ROOT}/inc")
The CMakeLists.txt (marked as [3]) for the dependencies is:
add_subdirectory(log)
What I'm trying to do is to have the contents of the dep/log/include folder copied inside a new folder called inc/log, so that in main.cpp I can write something like #include <log/log.h>, but I don't understand how. I would like to avoid editing the CMakeLists.txt of the logger project.
My solution: in /dep/CMakeLists.txt I added
file(MAKE_DIRECTORY "${APP_ROOT}/inc/log")
file(COPY "log/include/" DESTINATION "${APP_ROOT}/inc/log")