Trip

This is the main entity. We create one note for each trip, which then links to all related notes such as Accommodation, FnB, Landmark, or any other Location.

Fields

Inline

Queries

Embedded Map

dataviewjs
// Access the current file's frontmatter and name
const frontmatter = dv.current().file.frontmatter;
const fileName = dv.current().file.name;

// Check if 'locations' exists in the frontmatter
if (frontmatter && frontmatter.locations) {
    // Split the 'locations' string by comma and trim spaces
    const [centerLat, centerLng] = frontmatter.locations.toString().split(",").map(coord => coord.trim());

    // Construct the mapview block as a string
    const mapviewBlock = `\`\`\`mapview
{
    "name": "Default",
    "mapZoom": 6,
    "centerLat": ${centerLat},
    "centerLng": ${centerLng},
    "query": "linkedfrom:\\"${fileName}\\" OR linkedto:\\"${fileName}\\" ",
    "chosenMapSource": 0,
    "showLinks": false,
    "linkColor": "red",
    "markerLabels": "left"
}
\`\`\``;

    // Display the mapview block
    dv.paragraph(mapviewBlock);
} else {
    console.error("Locations field is missing or not in the expected format.");
    // Display an error or a message directly on the page
    dv.paragraph("Error: Locations field is missing or not in the expected format.");
}

Travel duration

dataviewjs
const currentPage = dv.current();
const departureDate = dv.date(currentPage.Departure);
const returnDate = dv.date(currentPage.Return);
const daysBetween = returnDate.diff(departureDate, 'days').days;

dv.paragraph(`Trip duration: ${daysBetween} days`)