You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: page_generator.rb
    path of file: ./repos/railsui/lib/generators/railsui
    
    the code of the file until where you have to start completion: # frozen_string_literal: true

require "rails/generators/named_base"

module Railsui
  module Generators
    class PageGenerator < Rails::Generators::NamedBase
      include Rails::Generators::ResourceHelpers

      source_root File.expand_path('../templates', __FILE__)

      desc "Adds additional routing and views for a given page."

      # TODO: Figure out how to add mutliple actions to t
    
      def add_to_navigation
        @add_to_nav = pages_config[Railsui.config.theme][display_name]&.fetch("add_to_nav", true)

        return unless @add_to_nav
        # TODO: Adjust nav link based on
        # Dynamically append a navigation link for the page
        link_path = namespace.present? ? "#{namespace}_#{display_name}_path" : "#{display_name}_path"
        inserted_link = <<-ERB
<li>
  <%= nav_link_to "#{display_name.titleize}", send("#{link_path}"), class: "nav-link" %>
</li>
ERB
        # Here I scope partials per namespace if present. Typically with a new namespace, there will be a new layout and thus navigation pattern. i.e. Marketing vs. Admin
        partial_folder = namespace.present? ? File.join("app/views/shared", namespace) : "app/views/shared"
        partial_path = File.join(partial_folder, "_nav_links.html.erb")

        append_to_file partial_path, inserted_link
      end